Here is the context of this question.
Hartshorne claim that $O_X(U)\cong \beta_*(O_V)(U)=O_V(\beta^{-1}(U))$ for any open $U\subset X=\operatorname{Spec}A$,but it is possible that $\beta^{-1}(U)=\emptyset$ for some $U$.For example,let $U=X-\beta(V)$,since $\beta$ is a homeomorphism from $V$ to $\beta(V)\subset X$,$U$ is open and $\beta^{-1}(U)=\emptyset$.So $O_X(U)=0$.Contradiction?
Edit:There are no mistakes.We can show that $\beta^{-1}(U)\neq\emptyset$ for any $U \neq\emptyset$ using the fact that $\beta(V)$ is dense in $X$.
There is no mistake in Hartshorne: the map $\beta : V\to X$ is indeed a homeomorphism onto its image but that image $\beta (V)\subset X$ is not closed, so that its complement $U$ is not open and the suggested counter-example collapses.
The simplest illustration:
Take for $V$ the affine line $\mathbb C$ so that $A=\mathbb C[T]$ and $X=\operatorname {Spec}(A)=\mathbb A^1_{\mathbb C}$.
The map $\beta $ sends $\mathbb C$ homeomorphically onto the set $\mathbb A^1_{\mathbb C}(\mathbb C)$ of closed points of $X$, but the complement $U=X\setminus \beta (V)=X\setminus \mathbb A^1_{\mathbb C}(\mathbb C)=\{\eta\}$ is the singleton set consisting of just the generic point $\eta$ and that singleton set is not open in $X$.