Lemma 31.28.2. Let $X$ be a locally Noetherian scheme. Let $U \subset X$ be an open and let $D \subset U$ be an effective Cartier divisor. If $\mathcal{O}_{X, x}$ is a UFD for all $x \in X \setminus U$, then there exists an effective Cartier divisor $D' \subset X$ with $D = U \cap D'$.

Proof. Let $D' \subset X$ be the scheme theoretic image of the morphism $D \to X$. Since $X$ is locally Noetherian the morphism $D \to X$ is quasi-compact, see Properties, Lemma 28.5.3. Hence the formation of $D'$ commutes with passing to opens in $X$ by Morphisms, Lemma 29.6.3. Thus we may assume $X = \mathop{\mathrm{Spec}}(A)$ is affine. Let $I \subset A$ be the ideal corresponding to $D'$. Let $\mathfrak p \subset A$ be a prime ideal corresponding to a point of $X \setminus U$. To finish the proof it is enough to show that $I_\mathfrak p$ is generated by one element, see Lemma 31.15.2. Thus we may replace $X$ by $\mathop{\mathrm{Spec}}(A_\mathfrak p)$, see Morphisms, Lemma 29.25.16. In other words, we may assume that $X$ is the spectrum of a local UFD $A$. Then all local rings of $A$ are UFD's. It follows that $D = \sum a_ i D_ i$ with $D_ i \subset U$ an integral effective Cartier divisor, see Lemma 31.15.11. The generic points $\xi _ i$ of $D_ i$ correspond to prime ideals $\mathfrak p_ i \subset A$ of height $1$, see Lemma 31.15.3. Then $\mathfrak p_ i = (f_ i)$ for some prime element $f_ i \in A$ and we conclude that $D'$ is cut out by $\prod f_ i^{a_ i}$ as desired. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).