Functions in the Structure Sheaf of an Affine Scheme on Arbitrary Open Sets In Vakil's FOAG, the structure sheaf $\mathcal O_{\operatorname{Spec} A}$ is defined on distinguished open sets to be functions in $A$ localized at the multiplicative set of functions not vanishing in $D(f)$. He then claims (imprecisely, since the language has not yet been developed), that this definition does not work for arbitrary open sets $U$. 
He then provides a counterexample: glue two copies of $\mathbb A^2_k$ at their origins, and call this $\operatorname{Spec} A$. Let $U$ be $\operatorname{Spec} A$ minus the origin(s). The function which is $0$ in one copy of $\mathbb A^2_k$ minus the origin and $1$ in the other copy is the counterexample. How do we know this function is not of that type?
He then says this idea does not work if you replace $\mathbb A^2_k$ with $\mathbb A^1_k$. Why is that? I have a hunch this has something to do with the fact that the only nontrivial points in $\mathbb A^1_k$ correspond to maximal ideals (if $k$ is algebraically closed), but I don't see it.
 A: This is just a straightforward computation. Let's first identify what the localization of $A$ at the set of functions which do not vanish away from the common origin is.
I claim that the collection of functions $S\subset A$ which do not vanish away from the common origin is just the units of $A$. To do the interesting inclusion, note that the vanishing locus of a function on an affine scheme is either empty (units), everything (nilpotents), or purely codimension one (nonunit nonnilpotents) by Krull's Hauptidealsatz. So $f$ vanishes nowhere, so it's a unit, and thus $S^{-1}A=A$ because all of $S$ is already invertible.
On the other hand, our function which is $0$ and $1$ is not an element of $A$: such a function would have to simultaneously have the value $0$ and $1$ at the origin, which is obviously wrong.
The reason this counterexample fails with $\Bbb A^1$ instead of $\Bbb A^2$ is that the point of intersection is pure codimension one inside two copies of $\Bbb A^1$ meeting at point, so the argument with Krull's Hauptidealsatz doesn't work and we really can just find functions which vanish just at the point of intersection (if we write the two copies of $\Bbb A^1$ glued together as $\operatorname{Spec} k[x,y]/(xy)$, we can take $x+y$, for instance).
