Let $X=\operatorname{Spec} k[w,x,y,z]/(wz−xy)$. Show the Weil divisor cut out by $w=x=0$ is not locally principal. This is exercise 14.2.R from Vakil's notes. Let $X=\operatorname{Spec} k[w,x,y,z]/(wz-xy)$. Let $Z$ be the Weil divisor cut out by $w=x=0$. I want to show that $n[Z]$ is not locally principal for all $n\neq0$.
To do this I assumed $n[Z]$ is locally principal for some $n$, and got it to where I just have to show that the complement of $Z$ is affine. However I'm stuck on how to show it's affine, any suggestions?
 A: As Vakil explained in his note, if we consider the closed subscheme $Y:=(y=z=0)$ of $X$, then $Y=\operatorname{Spec} k[w,x,y,z]/(wz-xy,y,z)\cong \operatorname{Spec} k[w,x]$ is isomorphic to the $wx$ plane. 
If $X-Z$ is affine, then $Y-Z$ is a closed subscheme of the affine scheme $X-Z$, hence $Y-Z$ is itself affine. But $Y-Z$ is isomorphic to the affine plane $(y=z=0)$ minus the origin $(w=x=0)\cap (y=z=0)$ which is not affine, so we get a contradiction. Therefore, $X-Z$ is not affine.
Edit: Since $X$ is a noetherian normal integral affine scheme, $n[Z]$ is an effective Weil divisor of $X$ for $n\geq 0$.
If $n[Z]$ is locally principal, then $X$ can be covered by affine open subsets $U_i$ such that $n[Z\cap U_i]$ is principal in $U_i$. Suppose $U_i=\operatorname{Spec}A_i$, and $n[Z\cap U_i]=div (f_i)$ for $f_i\in K(A_i)^*$. Since $n[Z\cap U_i]$ is effective, $f_i$ is regular at the generic point of any codim $1$ irreducible closed subset of $U_i$, i.e. $f_i\in {A_i}_\mathfrak{p}$ for any height $1$ prime ideal $\mathfrak{p}$ of $A_i$.
Since $X$ is normal and integral, $A_i$ is an integrally closed integral domain, by algebraic Hartog theorem (11.3.10 in Vakil's notes or II.6.3A in Hartshorne), $A_i=\bigcap_{ht(\mathfrak{p})=1}{A_i}_\mathfrak{p}$, hence $f_i\in A_i$. Therefore, $Z\cap U_i\subseteq V(f_i)$. By Krull's Principal Ideal theorem (11.3.2 in Vakil's notes or I.1.11A in Hartshorne), every irreducible component of $V(f_i)$ has exactly codimension $1$, so $div(f)=n[Z\cap U_i]$ implies $V(f_i)=Z\cap U_i$. Therefore, $U_i\cap(X-Z)=D_{A_i}(f_i)$ is an affine scheme for all $i$.
Now we prove $X-Z$ is affine. Consider the open immersion $\phi:X-Z\rightarrow X$. For the affine open covering $\{U_i\}$ of $X$, we have $\phi^{-1}(U_i)=U_i\cap(X-Z)=D_{A_i}(f_i)$ which is also affine for all $i$, so $f$ is an affine morphism. As a result, $X-Z=\phi^{-1}(X)$ is the preimage of an affine scheme under the affine morphism $\phi$, so $X-Z$ is affine. (We use the fact that the property "affiness" of morphisms is affine-local on the target, from 7.3.4 in Vakil's notes.)
