Sorry for being so confusing in the comments. Guess that's what happens when you try to answer a question so late at night.
I'll first answer using Hartog's lemma.
Hartog's Lemma: Let $X$ be a normal algebraic variety. Let $U$ be an open subset of $X$ such that $Z$, the complement of $U$, has codimension $\ge 2$ in $X$. Then, any function that is regular on $U$, extends to a regular function on $X$.
Corollary: If $X$ is a normal affine algebraic variety, and $U$ is an open subset whose complement has codimension $\ge 2$, then $U$ is not affine.
Proof of Corollary: By Hartog's lemma, $\mathbb{C}[U] \cong \mathbb{C}[X]$. The inclusion of $U$ into $X$ corresponds to the restriction map $\mathbb{C}[X] \rightarrow \mathbb{C}[U]$. This map is always an injection as opens are dense. But in this case, this map is also a surjection. Hence, the map at the level of rings is an isomorpism. If $U$ were affine, then the inclusion of $U$ into $X$ would have to be an isomorphism. This is clearly false. Hence, $U$ is not affine.
Here's a way to sidestep this issue of Hartog's lemma using gcd's in this case (I still wanted to state it for your benefit since it's an important fact that you should know). This method will basically work as long as $X$ is the spectrum of a UFD. The really crucial thing in the corollary is that any regular function on $U$ extends to a regular function on $X$. So, let $p$ be a regular function on $U$. Let $U_{i}$ be $\mathbb{C}[X] \backslash \{f_{i} = 0\}$, so that
$$U = \bigcup_{i} U_{i}.$$
Restrict $p$ to $U_{1}$ to get a regular function on $U_{1}$, which must be of the form $p_{1}/f_{1}^{a}$, with $p_{1}, f_{1}$ relatively prime and $a \in \mathbb{Z}$. Do the same for $U_{2}$ to get an expression $p_{2}/f_{2}^{b}.$ Then,
$$\frac{p_{1}}{f_{1}^{a}} = \frac{p_{2}}{f_{2}^{b}}$$
(as long as $U_{1} \cap U_{2}$ is nonempty) and hence
$$p_{1}f_{2}^{b} = p_{2}f_{1}^{a}.$$
This implies that $a$ must be nonpositive, because neither $p_{1}$ not $f_{2}$ share any prime factors in common with $f_{1}$ (the gcd condition). Hence, we can write
$$p = p_{1}f_{1}^{-a}$$
and as $-a$ is nonnegative, this is clearly a function that is regular on all of $X$. Hence, we have shown that any function on $U$ extends to one on $X$ and the corollary still holds.