Are all prime ideals in a Dedekind domain also principal ideals? Suppose I have a domain that is not a principal ideal domain $R$, and I have a non-principal prime ideal $\mathfrak{p}$. Then $R_{\mathfrak{p}}$ has a maximal ideal given as
$$I=\left\{\frac{x}{y} | x\in\mathfrak{p},y\notin\mathfrak{p}\right\}$$
This is a maximal ideal because:


*

*It's closed under multiplication: If $\frac{x}{y}\in I$, then for any $\frac{x'}{y'}$ with $y'\notin\mathfrak{p}$, $xx'\in \mathfrak{p}$ since it's an ideal, and if $yy'\in\mathfrak{p}$, then since $\mathfrak{p}$ is prime, one of $y,y'$ would have to be in $\mathfrak{p}$, but we know both of them are not.

*It's closed under addition:If $\frac{x}{y},\frac{x'}{y'}\in I$, then $\frac{xy'+yx'}{yy'}\in I$ since $xy'+yx'\in \mathfrak{p}$ since it's an ideal, and $yy'\notin\mathfrak{p}$ by the same logic as before.

*Everything not in $I$ is a unit, and for any $\frac{x}{y}\in I$ and $\frac{x'}{y'}\notin I$, $\frac{x}{y}+\frac{x'}{y'}=\frac{xy'+x'y}{yy'}$. Since $xy'\in \mathfrak{p}$, then if $xy'+x'y\in \mathfrak{p}$, then $x'y\in \mathfrak{p}$. But neither $x'$ nor $y$ are in $\mathfrak{p}$, and since it's prime, their product cannot be either. Thus, the numerator is not in $\mathfrak{p}$ so it is a unit of $R_{\mathfrak{p}}$.


Since $I$ is basically just the localization of $\mathfrak{p}$ by $R\setminus\mathfrak{p}$, and $\mathfrak{p}$ is not a principal ideal, then won't $I$ also not be a principal ideal?
Since $I$ must be principal for $R$ to be a Dedekind domain, then can we conclude that if a ring $R$ is a Dedekind domain then there are no prime ideals that are not principal?
 A: In a Dedekind domain $R$, if all prime ideals are principal then all ideals in $R$ are principal since all (nonzero) ideals in $R$ are products of (nonzero) prime ideals. And many Dedekind domains are not PIDs, since otherwise concepts like the ideal class group of a Dedekind domain would be pointless to define.
An extreme illustration of what can be said on the theme you raised is that Zorn's lemma implies in an arbitrary commutative ring, if all prime ideals are principal then all ideals are principal. So in a ring with some nonprincipal ideal there is a nonprincipal prime ideal.
As Crostul points out in a comment, a ring with nonprincipal ideals can have a localization in which all ideals are principal.  In fact, for a Dedekind domain $R$ its localization at every prime ideal is principal and Dedekind domains are not always PIDs. The whole point of localizing a Dedekind domain at a prime is that it makes the structure much simpler, e.g., all ideals are now principal (and in fact all nonzero ideals in the localization are powers of the maximal ideal).
A: For example, $R = \mathbf Z[\sqrt{-5}]$ is a Dedekind domain but isn't a PID since $$ 2 \cdot 3 = (1 + \sqrt{-5})(1 - \sqrt{-5})$$ represents a non-unique factorization.
So now let us look at the prime ideal $\mathfrak p = (2, 1 + \sqrt{-5})$. This is not principal (as explained in the answer that user26857 linked to) but its localization, $\mathfrak p R_{\mathfrak p}$, is generated by $1 + \sqrt{-5}$, because
$$ 2 = \frac{6}{3} = \frac{(1 - \sqrt{-5})}{3}(1 + \sqrt{-5}) \in (1 + \sqrt{-5})R_{\mathfrak p}. $$
On the other hand $2 \notin (1 + \sqrt{-5})R$ since
$$ \frac{(1 - \sqrt{-5})}{3} $$
is not an algebraic integer (its norm is $2/3$).
