# Irreducible subvariety not cut out by one equation

Let $X$ be an irreducible nonsingular algebraic variety. Let $Y$ be an irreducible codimension 1 closed subvariety. An important theorem states that locally $Y$ is cut out by a single equation regular in the neighborhood of a given point. What would be an example where this is not true globally?

In other words,

What is an example of $X,Y$ as above in which no rational function on $X$ has precisely $Y$ as a zero set?

(If $X$ is affine and $k[X]$ is a UFD then $Y$ is always globally cut out by one equation. Similarly if $X$ is projective and the homogeneous coordinate ring is a UFD. So I know I need a failure of unique factorization to get the example I want. That said, so far I haven't constructed it, so I humbly turn to your assistance.)

-

Consider the blowup $X=\operatorname{Bl}_{(0,0)}\Bbb A^2$ of the affine plane at the origin, and let $Y\subseteq X$ denote the exceptional divisor. Note that $X$ and $\Bbb A^2$ are birational (and are irreducible and nonsingular), hence $k(X)\cong k(\Bbb A^2)=k(x,y).$ Thus, a rational function cutting out $Y$ globally on $X$ must correspond to a rational function $\dfrac{f(x,y)}{g(x,y)}$ cutting out $(0,0)$ on $\Bbb A^2,$ which is of course impossible, since the origin has codimension two.