Let $X$ be a Noetherian integral affine scheme. Let $U\subset X$ be an open subscheme whose complement has irreducible components of codimension $1$. Is $U$ affine?
Some remarks:
- By EGA 4, Cor. 21.12.7, the complement of a codimension 2 closed subset is not affine.
- if $X$ is the spectrum of a UFD, then I believe this can not happen. The ideal defining the complement has height 1. Thus the radical has height 1, so it is an intersection of prime ideals of height 1 so it is principal.
- if $X$ is of Krull dimension 1 (e.g. Dedekind domain), this can not happen.