The answer to the question in the title is "yes". This is proved for example here, or here (page 5).
However, I seem to be able to construct a counterexample. Can you help me find the flaw in my argument?
Let $E$ be an elliptic curve, say over $\mathbb C$. Then $E-\{0\}$ is the spectrum of a Dedekind domain $R$, and has class group isomorphic to $E(\mathbb C)$. (Because $\mathrm{Cl}(E)=E(\mathbb C)\times \mathbb Z$, and $\mathrm{Cl}(E-\{0\})$ is the quotient of $\mathrm{Cl}(E)$ by the cyclic subgroup generated by $[0]$.) Now the class group of $\mathrm{Spec}(R)$ is just the ideal class group of $R$. Take a non-torsion point of $E$, considered as a prime ideal $\mathfrak{p}$ of $R$. I claim that $S:=\mathrm{Spec} (R)-\{\mathfrak{p}\}$ is not affine.
Let $T=\Gamma (S,\mathcal O_S)=\{ {{a}\over{b}}\in Q(R) |b\notin \mathfrak{q}\in \mathrm{Spec}(R),\mathfrak{q}\neq \mathfrak{p}\}$. I will show that $T=R$. It suffices to show that every element $x\in \mathfrak {p}$ is also contained in some other prime ideal than $\mathfrak p$. Were it not so, then the principal ideal $(x)$ would be equal to $\mathfrak{p}^n$ for some $n$, by the unique prime decomposition of ideals in Dedekind domains. But the image of $\mathfrak{p}$ in the ideal class group is a non-torsion element, so no power of $\mathfrak{p}$ can be a principal ideal. Therefore $T=R$, and $S\neq\mathrm{Spec}(R)=\mathrm{Spec}(T)$, and hence $S$ is not affine.
($S$ and $\mathrm{Spec}(R)$ really are nonisomorphic, because for instance they have different etale fundamental groups)
Your description of $T$ is at best very confusing, because an element of $Q(R)$ has several ways to be written as a fraction, and what follows depends heavily on which representative you take. A clearer way to describe it should be the set of functions on the elliptic curve whose poles are restricted to $0$ and $p$.
In your description you are restricting the denominators too much. Maybe you can find a fraction where the denominator has a zero somewhere else, but where the numerator also coincidentally has a zero there.
Indeed if you find two points $A,B$ such that the divisor $A+B$ is linearly equivalent to the divisor $0 + p$, then there is a function whose divisor is $A+B-0-p$, so this is an element of $T$
If your curve is in Weierstrass form and $0$ is the point at infinity, you can for example look at a half of $p$ : If $2q = 0 + p$, then the tangent line at $q$ crosses the elliptic curve at $-p$, so when you divide the equation of the tangent line going through $q,q,-p$ by the equation of the line going through $0,p$ and $-p$ (this is the vertical line $x=x_p$), you obtain an element $f = (ax+by+c)/(x-x_p)$ of $T$ for some $a,b,c \in \Bbb C$.
You cannot find a description of $f$ as a fraction whose denominator only vanish at $p$, but for every other point $q$ you can find a representation with a denominator who doesn't vanish at $q$, it will just have to vanish somewhere else (and be cancelled with the corresponding numerator)
So you can write $T = \{ f \in Q(R) \mid \forall \mathfrak q \neq \mathfrak p, \exists a,b \in R, f = a/b, b \notin \mathfrak q\} = \bigcap_{\mathfrak q \neq \mathfrak p} R_ \mathfrak q$ (where $R_\mathfrak q = (R \setminus \mathfrak q)^{-1}R$) which is pretty close to your original statement, but where it's made clear that $f$ can change its representative to show it is a good function defined everywhere.