Theorem 8.19 of Hartshorne states the following:

Let $ X $ and $ X^{'} $ be two birationally equivalent nonsingular projective varieties over $ k $. Then $ p_{g}(X) = p_{g}(X^{'}) $.

I thought of the following generalization, which turned out to be wrong.

``Generalization'':

Let $ \pi $ be a presheaf of invertible sheaves over the category of normal varieties over $ k $ (an example would be the map which assigns such a variety its canonical divisor or anticanonical divisor). If $ X $ and $ X^{'} $ are two birationally equivalent, normal, complete varieties over $ k $, then $ h^{0}(X, \pi(X)) = h^{0}(X^{'}, \pi(X^{'})) $.

P``r''oof:

Let $ V \subseteq X $ be the largest open set for which there is a morphism $ f: X \to X^{'} $. There is a map $ \pi(f): \pi(X^{'}) \to \pi(V) $. This map induces a map of global sections $ H^{0}(X^{'}, \pi(X^{'})) \to H^{0}(V, \pi(V)) $. Since $ X $ and $ X^{'} $ are birational, there is a dense open set $ U \subseteq V $ such that $ f(U) $ is open in $ X^{'} $, and $ f $ induces an isomorphism from $ U $ to $ f(U) $. Therefore $ \pi(V)\mid_{U} \cong \pi(X^{'}) \mid_{U} $ via $ f $. Since a nonzero global section of an invertible sheaf cannot vanish on a dense open set, we conclude that the map of vector spaces $ H^{0}(X^{'}, \pi(X^{'})) \to H^{0}(V, \pi(V)) $ must be injective.

We claim that $ X \setminus V $ has codimension greater than or equal to two in $ X $. If $ x \in X $ is a point of codimension one, then because $ X $ is normal and thus regular in codimension one, $ \mathcal{O}_{X,x} $ is a DVR. We already have a morphism of the generic point of $ X $ to $ X^{'} $ , and because $ X^{'} $ is proper over $ k $ there exists a unique morphism $ \operatorname{Spec}(\mathcal{O}_{X,x}) \to X^{'} $ which is compatible with the given birational map. This extends to some neighborhood of $ x $, so we must have that $ x \in V $.

For any affine subset $ U \subseteq X $ such that $ \pi(X)\mid_{U} \cong \mathcal{O}_{U} $ we see that $ H^{0}(U, \mathcal{O}_{U}) \to H^{0}(U \cap V, \mathcal{O}_{U \cap V}) $ is bijective because $ X $ is normal, and $ U \setminus U \cap V $ has codimension greater than or equal to two in $ U $. This shows that $ h^{0}(X^{'}, \pi(X^{'})) \le h^{0}(X, \pi(X)) $. By symmetry $ h^{0}(X^{'}, \pi(X^{'})) = h^{0}(X, \pi(X)) $. IAQE, or Ita argumentor quasi ebrios (thus I argue like a drunken man).

I know something is wrong with this argument for the following reason. Let $ X $ be a non-singular, degree two, hypersurface of $ \mathbb{P}^{3}_{k} $. The variety $ X $ is rational by Castelnuovo's criterion. Therefore, if this generalization was correct, then $ h^{0}(X, -K_{X}) $ would be equal to $ h^{0}(\mathbb{P}^{2}_{k}, -K_{\mathbb{P}^{2}_{k}}) $.

If $ \iota_{X} $ is the inclusion of $ X $ in $ \mathbb{P}^{3}_{k} $, then $ -K_{X} \cong \iota_{X}^{\ast}(\mathcal{O}_{\mathbb{P}^{3}_{k}}(2)) $. If one tensors the exact sequence for the ideal sheaf of $ X $, then one can use that sequence as follows: \begin{align*} h^{0}(X,-K_{X}) & = h^{0}(\mathbb{P}^{3}_{k}, \iota_{X,\ast}(\mathcal{O}_{X}) \otimes \mathcal{O}_{\mathbb{P}^{3}_{k}}(2)) \\ &= h^{0}(\mathbb{P}^{3}_{k}, \mathcal{O}_{\mathbb{P}^{3}_{k}}(2))- h^{0}(\mathbb{P}^{3}_{k}, \mathcal{O}_{\mathbb{P}^{3}_{k}}) \\ &= \binom{5}{2}-1 \\ &= 9 \end{align*} whereas $ h^{0}(\mathbb{P}^{2}_{k}, -K_{\mathbb{P}^{2}_{k}}) $ is equal to ten. Why does this argument fail, and when are such sheaves birational invariants?