Localization and intersection It is very well known that if $\mathfrak p_1, \ldots,\mathfrak p_n$ are prime ideal of an integral domain $A$, then we have the equality$$S^{-1}A=\bigcap_{i=1}^n A_{\mathfrak{p}_i},$$ where  $S:=A\setminus\cup_i\mathfrak p_i$. 
For a proof of the above, see for example this.
Now I'm asking myself if the equality above holds true for any family (infinite) of prime ideals. Any reference or counterexample would be appreciated.
 A: With a view to understand to which extent OP's identity can fail, I am sharing these easy positive results. The emphasis is on the fact that OP's question tightly relates to (generalizations of) the prime avoidance lemma for ideals of denominators.
Let $A$ be an integral domain. Let $(\mathfrak{p}_i)_{i \in I }$ be an arbitrary family of prime ideals of $A$. Let $S = A \setminus \bigcup_{i \in I} \mathfrak{p}_i$.

Claim 1. The inclusion $S^{-1}A \subset \bigcap_{i \in I} A_{\mathfrak{p}_i}$ always holds. If moreover $\{\mathfrak{p}_i\}_{i \in I}$ contains the set of all maximal ideals of $A$, then $A = S^{-1}A = \bigcap_{i \in I} A_{\mathfrak{p}_i}$.
Proof. Elementary, see e.g., [1, Theorem 4.7].

Let $R$ be an arbitrary commutative ring with identity. We say that $R$ satisfies the prime avoidance lemma for unions of cardinality $\kappa$ if for every ideal $I$ of $R$ and every index set $K$ of cardinality $\kappa$, the inclusion $I \subset \bigcup_{k \in K} P_k$ implies $I \subset P_l$ for some $l \in K$, where the ideals $P_k$ are arbitrary prime ideals of $R$.
Note that the prime avoidance lemma for countable unions holds for some interesting classes of rings, see for instance the answer of Neil Epstein to this MO post. For more on prime avoidance, I recommend [Exercises 3.16 to 3.20, 2]. The bleeding-edge results on infinite prime avoidance are as of today in [3].

Claim 2. If $A$ is GCD domain, or satisfies the prime avoidance lemma for unions of cardinality $\vert I \vert$, then $S^{-1}A = \bigcap_{i \in I} A_{\mathfrak{p}_i}$.
Proof. Let $x \in \bigcap_{i \in I} A_{\mathfrak{p}_i}$ and let $\mathfrak{d} = \{ d \in A \, \vert \, dx \in A \}$ be the ideal of denominators of $x$. Then we have $\mathfrak{d} \not\subset \mathfrak{p}_i$ for every $i \in I$. If $A$ is a GCD domain, then $\mathfrak{d}$ is a principal ideal generated by some $d_x \in S$, thus $x \in S^{-1}A$. If $A$ satisfies the prime avoidance lemma for unions of cardinality $\vert I \vert$, then we certainly have $\mathfrak{d} \cap S \neq \emptyset$, so that $x$ has a denominator in $S$.


[1] H. Matsumura, "Commutative Ring Theory", 1986.
[2] D. Eisenbud, "Commutative Algebra with a View Toward Algebraic Geometry", 1995.
[3] J. Chen, "Infinite prime avoidance", 2017.
A: This is not true. Morally, the right hand side corresponds to the functions that are regular at all $\mathfrak p_i$, and one can show that this is not always a localisation of the entire ring $A$.
Example. Let $(E,O)$ be an elliptic curve over an algebraically closed field $k$, and let $P \in E(k)$ be a non-torsion point. Let $X = E \setminus \{O\}$, and $U = X \setminus\{P\}$. Then $X$ and $U$ are affine, and $U$ is not a principal affine open of $X$ (see e.g. this post).
If $X = \operatorname{Spec} A$, then $P$ corresponds to a prime $\mathfrak p \subseteq A$. We consider the intersection
$$\bigcap_{\mathfrak q \neq \mathfrak p} A_\mathfrak q \subseteq \operatorname{Frac} A$$
and the set
$$S = A \setminus \bigcup_{\mathfrak q \neq \mathfrak p} \mathfrak q.$$
(In either case, it doesn't matter whether we include the zero ideal as well or only the maximal ideals.)
We claim that $S = A^\times$. Indeed, clearly $A^\times \subseteq S$. Conversely, suppose $f \in A$ is not in $A^\times$. Then $V(f)$ contains a point $Q \neq P$, hence $f$ is contained in a prime $\mathfrak q \neq \mathfrak p$. Thus, $f \not \in S$.
This proves that $S = A^\times$, and therefore $S^{-1}A$ is just $A$. But if $B = \Gamma(U,\mathcal O_U)$, then
$$\bigcap_{\mathfrak q \neq \mathfrak p} A_{\mathfrak q} = \bigcap_{\mathfrak r \in \operatorname{Spec} B} B_{\mathfrak r} = \Gamma(U,\mathcal O_U),$$
which cannot be equal to $A$ because $X \not \cong U$. $\square$
