TITLE: Line bundles on open subset of projective variety that don't extend over entire variety
QUESTION [9 upvotes]: I'm looking for an example of the following.  Let $X$ be a smooth quasiprojective variety over $\mathbb{C}$ and let $\overline{X}$ be a compactification of $X$.  We then have a map $Pic(\overline{X}) \rightarrow Pic(X)$.  I want an example where this map is not surjective.  It will be surjective if, for example, $\overline{X}$ is smooth, but I don't think it should be surjective in general.  I'd also be interested in conditions under which it will be surjective.
Thanks!
EDIT : Here are a couple of thoughts.  Since $X$ is smooth, every line bundle on it comes from a Weil divisor.  The closure in $\overline{X}$ of a Weil divisor in $X$ is another Weil divisor.  The only thing that could go wrong is that this new Weil divisor might not come from a line bundle.  Thus we are looking for Weil divisors that don't come from Cartier divisors, but I don't know enough examples of this to get what I'm looking for.

REPLY [4 votes]: Your argument is absolutely correct, as long as $\bar{X} \setminus X$ is of codimension at least 2; this ensures that the only possible Weil divisor on $\bar{X}$ which restricts to your chosen $D$ on $X$ is just the closure of $D$ in $\bar{X}$.
So you need to think of your favourite example of a projective variety with a non-Cartier divisor, which is probably the quadric cone $x^2 + y^2 = z^2$ in $\mathbb{P}^3$.  Any line through the vertex of the cone is a Weil divisor which is not locally principal.  Take $X$ to be the cone with the vertex removed, and you have your example.  In this case $X$ is isomorphic to $(\textrm{conic}) \times \mathbb{A}^1$, so $\textrm{Pic}\; X \cong \mathbb{Z}$. On the other hand, any two lines passing through the vertex together form a plane section, which is a Cartier divisor.  So the image of $\textrm{Pic}\; \bar{X} \to \textrm{Pic}\; X$ is $2\mathbb{Z} \subset \mathbb{Z}$.  (This example is described in many algebraic geometry textbooks, including Hartshorne, but I'm at home at the moment and can't give you a reference.  If you haven't seen it before, it's worth spending a little while seeing in detail what's going on here.)
One condition which implies surjectivity is that your variety be locally factorial (since then every Weil divisor is Cartier).