$f$ is contained in no codimension $0,1$ primes $\implies f$ is invertible. Why do we need codim 1 primes as well? 
11.3.G Let $A$ be a Noetherian ring, and $f$ be an element that is not contained in any codimension zero or one primes. Then $f$ is invertible.

I found this statement in Vakil, and I am surprised that one needs the assumption that $f$ is not contained in any codimension $1$ primes to say that it is not invertible. Isn't it automatic that if $f$ is not contained in any maximal ideal it is invertible? Suppose not. Then (f) is a proper ideal because it doesn't contain (1). Hence it is contained in a maximal ideal.
Where do we need the assumption that $f$ is not contained in any codimension 1 prime?
 A: In general maximal ideals do not have codimension zero. The codimension of an ideal is its height: the largest chain of prime ideals it contains. In a reasonable ring, say integral and finitely generated over a field, the codimension of a maximal ideal is equal to the dimension of the ring, not zero.
For example, for integral domains, the question asks you to prove that if an element does not lie in any minimal prime ideal (that is a prime ideal containing no other prime ideals other than zero), than this element is invertible.
By the way: it is indeed clear that if an element does not lie any maximal ideal, then it is invertible. The geometric analogue is that if a function does not vanish at any point, then it is an invertible function. But the assertion here is that, for example, if a function on a 3 dimensional space does not vanish on any surface, then it is invertible. This is also obvious when stated in this geometric form, but not so clear for "non-geometric" rings.
A: The condition that $f$ is not contained in a codimension 1 prime is only a necessary but not sufficient condition for it to be non-invertible for a general ring. I will now prove the corresponding statement in commutative algebra that you need.


Let $A$ be a Noetherian ring; if $f \in A$ is not contained in any prime of height at most 1  then $f$ is invertible.


Proof (by the contrapositive): Suppose $f$ is not a unit. Choose a minimal prime in the ring $A/f\neq 0$  which exists by  Zorn's lemma. This corresponds back in the ring $A$ to a prime $\mathfrak{p}$ minimal amongst those containing $f$. The Krull Hauptidealsatz implies that $\mathfrak{p}$ has height at most $1$, finishing the proof.
