Here is an elementary algebraic solution. I prefer $R = K[x,y]/(y^2-x^3+x)$. To show that $R$ is not a UFD, it's enough to
show that $y$ is irreducible in $R$ (it's not prime, as $R/(y)$ is not a domain; the same reasoning shows it's not a unit).
This incidentally also implies that the ideal $(x,y)$ isn't principal, as any generator has to divide $y$ and $(x,y) \ne (y)$.
Suppose $y$ factors in $R$, so $y = fg + h(y^2-x^3+x)$ in $K[x,y]$ for some $f,g,h \in K[x,y]$.
We now use division in $K[x,y]$ by the polynomial $y^2-x^3+x$ with unique remainder of degree at most 1 in $y$.
So WLOG $f = f_1(x)y+f_2(x)$ and $g = g_1(x)y+g_2(x)$, where $f_i(x), g_i(x) \in K[x]$ and we get
$$(f_1(x)y+f_2(x))(g_1(x)y+g_2(x)) \equiv y \pmod{y^2-x^3+x},$$
i.e.
$$f_2 g_1 + f_1 g_2 = 1, \ f_1 g_1 (x^3-x) = - f_2 g_2$$
in $K[x]$. We see that $f_1 = 0$ iff $g_2 = 0$ iff $f \in K^\times$. Similarly, $g_1 = 0$ iff $f_2 = 0$ iff $g \in K^\times$.
so if our factorisation above is non-trivial, then $f_1,f_2,g_1,g_2$ are all non-zero. Moreover,
$\gcd(f_1,f_2) = \gcd(g_1,g_2) = 1$. Hence $f_1$ divides $g_2$ and $g_1$ divides $f_2$ in $K[x]$. writing $g_2 = f_1 v$ and
$f_2 = g_1 w$, we get
$$g_1^2 w + f_1^2 v = 1, \ x^3-x = - vw.$$
In particular, $\deg(v) \not\equiv \deg(w) \pmod 2$, so $\deg(g_1^2 w) \not\equiv \deg(f_1^2 v) \pmod 2$.
This implies that either $g_1^2 w$ or $f_1^2 v$ is of degree 0 and the other vanishes, contradiction.