A question about affine open subscheme of affine scheme Let $X=\mathrm{Spec}A$ and $U$ be an affine open subscheme of $X$.
Is there some $a\in A$ such that $D(a)=U$?
 A: This is true if $A$ is a noetherian UFD, but not in general - consider the complement of a point of infinite order inside an elliptic curve (ref). There is a closely related statement that is true for a slightly more general class of schemes: if $X$ is a noetherian normal integral separated scheme, then the complement of any proper nonempty affine open subscheme is of pure codimension one.
To prove this claim, let $U\subset X$ be a proper nonempty affine open subscheme of $X$, and let $W\subset X$ be an arbitrary affine open subscheme. As $X$ is separated, $W\cap U$ is also an affine open subscheme of $X$, and the open immersion $W\cap U\to W$ is determined by the restriction map on global sections $\mathcal{O}_X(W)\to\mathcal{O}_X(W\cap U)$. If $W\setminus (W\cap U)$ is of codimension at least two, then $W$ and $W\cap U$ contain the same height one points, and by Hartog's we have that $\mathcal{O}_X(W)=\mathcal{O}_X(W\cap U)$, which implies that $W\cap U = W$. Taking $W$ to be an affine open neighborhood containing precisely one generic point of $X\setminus U$, we see that $X\setminus U$ must be pure codimension one. $\blacksquare$
In the case that $X$ is the spectrum of a noetherian UFD, we have that $X\setminus U$ has finitely many generic points, each of which are height one primes. As a height one prime in a noetherian UFD is principal (ref), we may take a product of the generators of each such prime as $a$ - then $U=D(a)$.
A: This would imply that the complementary space of $U$ is $V(I)=V(a)$ and $I$ is principal. This is not always true.
