A commutative algebra is a PID if and only if it is a UFD and all nonzero prime ideals are maximal. This leads to an interesting method to construct PID's: Let $R$ be a UFD and let $S \subset R$ be a multiplicative set such that, for any prime $\mathfrak{p} \subset R$ of height $\geq 2$, there is some $f \in S$ with $f \in P$. Then $S^{-1} R$ will be a PID, because localizations of UFD's are UFD's and the poset of prime ideals in $S^{-1} R$ is obtained from the poset of prime ideals in $R$ by deleting those ideals containing an element of $S$.

This can be useful for building counterexamples, because $S^{-1} R$ is the forward limit of $f^{-1} R$ over all $f \in S$, and each of the $f^{-1} R$ will be a UFD but not a PID, so one can take counterexamples in UFD's and make them into PID counterexamples by this trick. Speaking vaguely, although $S^{-1} R$ has Krull dimension $1$, it often acts more like a ring of dimension equal to the Krull dimension of $R$.

I learned about this construction from Grayson's paper [$SK_1$ of an interesting principal ideal domain][1]. The PID in question is to take $R = \mathbb{Z}[T]$ and $S = \{ T \} \cup \{ T^n-1 : n > 0 \}$, and the interesting property is that $SL_n(S^{-1} R)$ is <b>not</b> generated by elementary matrices.

I can't resist showing off: After I read Grayson's paper, I come up with the following simpler example. Let $R = \mathbb{R}[x,y]$ and let $S$ be the set of nonzero polynomials in $\mathbb{R}[x^2+y^2]$. Then $S^{-1} R$ is a PID by the above argument. I claim that $M=\tfrac{1}{x^2+y^2} \left[ \begin{smallmatrix} x&y \\ -y&x \end{smallmatrix} \right]$ is not a product of elementary matrices. Suppose that $M=E_1 E_2 \cdots E_n$. Then the denominators of the $E_j$ only contain finitely many elements of $S$, so all the $E_j$ lie in $f(x^2+y^2)^{-1} R$ for some nonzero polynomial $f$. Choose some real number $r$ so that $f(r^2) \neq 0$, then each of the $E_j$ is a well defined continuous function on the circle $x^2+y^2 = r^2$. So $M=E_1 E_2 \cdots E_n$ gives a map from this circle to $SL_2(\mathbb{R})$. Consider the  class of this map in $H_1(SL_2(\mathbb{R})) \cong \mathbb{Z}$. Rescaling each off diagonal entry of the $E_j$ by a real number $t$ and sliding $t$ from $1$ to $0$ is a homotopy to the trivial map, so this class is $0$. On the other hand, $M=\tfrac{1}{x^2+y^2} \left[ \begin{smallmatrix} x&y \\ -y&x \end{smallmatrix} \right]$ represents the generator of $H_1$, a contradiction. The same argument shows that the block matrix $\left[ \begin{smallmatrix} M & \\ & \mathrm{Id}_{n-2} \end{smallmatrix} \right]$ in $SL_n(S^{-1} R)$ is also not a product of elementary matrices (this time we have $H_1(SL_n(\mathbb{R}))\cong H_1(SO_n(\mathbb{R})) \cong \mathbb{Z}/2$, and we need spin groups to compute the class in $H_1$, but I think it still works.).

  [1]: https://doi.org/10.1016/0022-4049(81)90089-X