Let $R$ be an integral domain and $K$ its field of fractions. Let $p(x), q(x) \in R[x]$ with $q$ monic. Let $f(x) = p(x)/q(x)$ and suppose $f(x) \not \in R[x]$ (i.e., $q(x)$ does not divide $p(x)$.)
Let $S$ be the smallest subring of $K$ containing $R$ that is closed under $f$. In other words, if $a \in S$ and $q(a) \ne 0$, then $f(a) \in S$. (Since $K$ itself is closed under $f$, and closure under $f$ is preserved under arbitrary intersections, the smallest subring $S$ exists.)
Must $S$ be a field?
(Motivation: If the answer is "no", then $S$ is a non-field counterexample to this question.)
Notes (taken from the answers to the above question):
If the assumption that $q$ is monic is dropped, there are easy counterexamples. For example, if $R=\mathbb{Z}$ and $f(x) = x(x-1)/2$, then $S = R = \mathbb{Z}$.
If it helps, there is no loss of generality in assuming that $\deg p < \deg q$. Since $q$ is monic, we may divide $p(x)/q(x) = s(x) + r(x)/q(x)$ where $s(x), r(x) \in R[x]$ and $\deg r < \deg q$; any ring containing $R$ is closed under the polynomial $s(x)$, so we may consider $r(x)/q(x)$ instead.