Let $A$ be a domain, not necessarily noetherian or normal, let $X = {\rm Spec}(A)$ and let $U\subseteq X$ be the complement of a prime divisor of $X$. Is it possible that $\mathcal O_U(U) = \mathcal O_X(X)$?

1$\begingroup$ Why is it an isomorphism? The element $v/t = u/s$ should be in $\mathcal O_U(U)$ but not in $\mathcal O_X(X)$, or not? $\endgroup$ – bog Feb 15 '17 at 0:17

1$\begingroup$ You are correct: I computed the ring incorrectly. $\endgroup$ – Jason Starr Feb 15 '17 at 1:18

1$\begingroup$ This variety $X$ is toric via the parametrization $x_0 = u, x_1 = v, y_0 = s, y_1 = vs/u, y_2 = v^2s/u^2$. So the dual cone which defines it is: $\sigma^\vee = \langle e_1^*, e_2^*, e_3^*, e_2^*+e_3^*e_1^*, 2e_2^*+e_3^*2e_1^*\rangle$, which gives $$\sigma = \langle e_3,e_2,e_1+2e_3,e_1+e_2\rangle.$$ The invariant divisor defined by $\mathfrak p$ corresponds to the ray generated by $e_3$. By removing it one gets the quasiaffine variety $U$ defined by the remaining three rays plus two of the three cones of dimension two. $\endgroup$ – bog Feb 15 '17 at 3:04

1$\begingroup$ The affine closure $\overline U$ of $U$ is the toric variety defined by the cone $\langle e_2, e_1+2e_3,e_1+e_2\rangle$. In particular ${\rm Cl}(\overline U)\simeq\mathbb Z/2\mathbb Z$ implies that $\overline U$ cannot be isomorphic to $X$, so that $\mathcal O_U(U) = \mathcal O_{\overline U}(\overline U)$ cannot be isomorphic to $\mathcal O_X(X)$. $\endgroup$ – bog Feb 15 '17 at 3:04

1$\begingroup$ I believe this is always true if $X$ is normal. $\endgroup$ – Avi Steiner Feb 15 '17 at 5:03
(Edited to add example) Yes, it may happen that $A=\mathcal{O}_X(U)$: I will give an example at the end. On the other hand, this cannot happen if $A$ is noetherian. More generally:
Proposition. If $U$ is quasicompact, then $A\subsetneq\mathcal{O}_X(U)$.
Put $Y:= X\smallsetminus U$, and let $\mathfrak{p}$ be the corresponding prime ideal. The assumption on $U$ means, equivalently, that there is a finitely generated ideal $I$ of $A$ such that $\mathfrak{p}=\sqrt{I}$.
To prove the proposition, observe first that it is clear if there is a principal $I=(t)$ as above. Indeed, in this case $t^{1}\in \mathcal{O}_X(U)\smallsetminus A$. In particular, it is true if $A$ is local with maximal ideal $\mathfrak{p}$: since $Y$ is a divisor and $A$ is a domain, we have $\mathfrak{p}=\sqrt{tA}$ for any nonzero $t\in \mathfrak{p}$.
For the general case, let $j:U\to X$ be the inclusion. Then $j$ is quasicompact and separated, which implies that $j_*$ preserves quasicoherence (EGA1, (6.7.1)) and commutes with flat base change for quasicoherent modules (EGA1, (9.3.2)). In particular $j_*\mathcal{O}_U$ is quasicoherent, hence determined by its $A$algebra of global sections $\mathcal{O}_X(U)$. So it suffices to prove that $\mathcal{O}_X\subsetneq j_*\mathcal{O}_U$. By the flat base change to $X':=\mathrm{Spec\,}(A_\mathfrak{p})$, the inclusion $\mathcal{O}_X\subset j_*\mathcal{O}_U$ is transformed into the similar inclusion $\mathcal{O}_{X'}\subset j'_*\mathcal{O}_{U'}$, which is not an isomorphism by the local case. QED
An example where $\mathcal{O}_X(U)=A$.
Take for instance $A=\overline{\mathbb{Z}}$, the ring of algebraic integers. This is a 1dimensional domain. Every closed point $x\in\mathrm{Max}(A)$ corresponds to a (rank one) valuation $v_x$ on $\overline{\mathbb{Q}}$, with valuation ring $\mathcal{O}_{X,x}$. Fix one such point $y$ and take $U=X\smallsetminus\{y\}$. I claim that $\mathcal{O}_X(U)=A$.
Indeed, take $z\in \mathcal{O}_X(U)$. Then $v_x(z)\geq0$ for each closed point $x\in\mathrm{Max}(A)\smallsetminus \{y\}$. We need to prove that $v_y(z)\geq0$ as well. For this it suffices to prove that for each $t\in\overline{\mathbb{Q}}$ the "pole set" $\{x\in \mathrm{Max}(A)\mid v_x(t)<0\}$ is either empty or infinite. Now, $t$ belongs to some number field $L\subset \overline{\mathbb{Q}}$, and the value of $v_x(t)$ (suitably normalized) depends only on the restriction of $v_x$ to $L$ (i.e. the image of $x$ in $\mathrm{Spec}(A\cap L)$). Since all the closed fibers of $\mathrm{Spec}(A)\to\mathrm{Spec}(A\cap L)$ are infinite sets, we are done.

$\begingroup$ Thank you! This answers the question in a quite general context. $\endgroup$ – bog Feb 17 '17 at 1:01