Let $A$ be a commutative Noetherian ring and $B$ a finitely generated $A$-algebra. Then the set $$U\colon=\{P\in\operatorname{Spec}B\mid B\_P\ \mathrm{is\ flat\ over}\ A\}$$ is open in $\operatorname{Spec}B$. (See, e.g., page 187 of Matsumara's *Commutative Ring Theory*.)


Is there a known example of a non finitely generated $A$-algebra $B$, where the set $U$ as defined above is *not* open? 



Counterexample to Openness of Flat Locus
Here is one example. Let $S$ denote the set of positive prime integers.
Let $A$ be $\mathbb{Z}$. Let $R$ be the countably generated polynomial ring over $\mathbb{Z}$, 
$$R = \mathbb{Z}[\{x\_p:p\in S\}].$$ Let $I\subset R$ be the ideal generated by $\{px\_p : p\in S\}$. Let $B$ be $R/I$. Then the ideal $\mathfrak{p}$ of $B$ generated by $\{x\_p : p\in S\}$ is prime, since $B/\mathfrak{p}$ is just the integral domain $\mathbb{Z}$. For every integer $p\in S$, $p$ is not in $\mathfrak{p}$. Hence, the localization of $B$ at $\mathfrak{p}$ factors through $B\otimes\_{\mathbb{Z}}\mathbb{Q}$. But, of course, this localization is already $(B/\mathfrak{p})\otimes\_{\mathbb{Z}}\mathbb{Q}$, which is $\mathbb{Q}$. Since $\mathbb{Q}$ is flat over $\mathbb{Z}$, thus $\mathfrak{p}$ is in $U$. 


Every Zariski open subset of $\text{Spec}(B)$ containing $\mathfrak{p}$ contains a *basic* open subset of the form, $$D(b)=\{\mathfrak{q} \in \text{Spec}(B) : b\not\in \mathfrak{q}\},$$ for some $b\in B\setminus \mathfrak{p}$. Since $b$ is not in $\mathfrak{p}$, $b$ equals $n+c$ for some $c\in \mathfrak{p}$ and for some nonzero $n\in \mathbb{Z}$. Of course $c$ is a polynomial in only finitely many of the variables $x\_p$. Also $n$ is divisible by only finitely many primes. Hence there exists a prime $q$ such that $c$ does not involve $x\_q$, and, also, $q$ does not divide $n$. 


Consider the unique surjective $\mathbb{Z}$-algebra homomorphism,
$$ u\_q : R \to (\mathbb{Z}/q\mathbb{Z})[x\_q],\ \ u\_q(x\_q) = x\_q, \ \ u\_q(x\_p) = 0,\ p\neq q. $$
Clearly $\text{Ker}(u\_q)$ contains $px\_p$ for every $p\neq q$, since $u\_q(x\_p)$ equals $0$. But since $q$ equals $0$ in $\mathbb{Z}/q\mathbb{Z}$, also $\text{Ker}(u\_q)$ contains $qx\_q$. Hence $u\_q$ factors through a unique surjective ring homomorphism,
$$ \overline{u}\_q: B \to (\mathbb{Z}/q\mathbb{Z})[x\_q].$$ Since $(\mathbb{Z}/q\mathbb{Z})[x\_q]$ is an integral domain, the ideal $\mathfrak{q}:=\text{Ker}(\overline{u}\_q)$ is a prime ideal of $B$. Also, since $\overline{u}\_q(c)$ equals $0$, $\overline{u}\_q(b)$ equals $\overline{u}\_q(n)$. Since $q$ does not divide $n$, $\overline{u}\_q(b)$ is nonzero. Thus $\mathfrak{q}$ is in $D(b)$. 


Of course for every prime $p\neq q$, since $\overline{u}\_q(p)$ is nonzero, also $p$ is not in $\mathfrak{q}$. Thus the localization $B\to B\_{\mathfrak{q}}$ factors through $B\otimes\_{\mathbb{Z}} \mathbb{Z}\_{(q)}$, which is clearly just $\mathbb{Z}\_{(q)}[x\_q]/\langle qx\_q \rangle$. Of course the image of $\mathfrak{q}$ in this localization is the principal ideal $\langle q \rangle$. In particular, $x\_q$ is not in this prime ideal. Hence, the localization inverts $x\_q$, and thus annihilates $q$. So $B\_{\mathfrak{q}}$ is simply the field $(\mathbb{Z}/q\mathbb{Z})(x\_q)$ of rational functions in the variable $x\_q$ over the field $\mathbb{Z}/q\mathbb{Z}$. 


The field $(\mathbb{Z}/q\mathbb{Z})(x\_q)$ is not flat over $\mathbb{Z}$, since $q$ is a zerodivisor. Thus $\mathfrak{q}$ is not in $U$. Therefore $D(b)$ is not contained in $U$. Since this holds for every $b\in B\setminus \mathfrak{p}$, $U$ contains no Zariski open neighborhood of $\mathfrak{p}$, even though $U$ contains $\mathfrak{p}$. Therefore $U$ is not a Zariski open subset of $\text{Spec}(B)$.


**Edit.** In fact, it is not hard to see that $U$ is *precisely* $\{\mathfrak{p}\}$ for this ring. 


**Second Edit.** I realize now that the ring $B$ above is "almost" a subring of the ring proposed by user76758 in the comments (I did not see that proposal until after I posted). Let $J$ be the ideal in $R$ generated by $px\_p$ and $x\_p^2-x\_p$ for every $p$ in $S$. Then $C=R/J$ is still a counterexample, for essentially the same reason as above. Also $C$ is isomorphic to the $\mathbb{Z}$-subalgebra of $\prod\_p \mathbb{F}\_p$ generated by every element $\overline{x\_p}$ that has coordinate $1$ in the $p$-factor and that has $0$ in every other factor. 


