Constructing nonprincipal ideals in a non-UFD It's well-known that all PIDs are UFDs, i.e. all non-UFDs are not PIDs. Now, it seems to me that there are two ways that a ring $R$ could fail to be a UFD:

*

*Some element $x$ has no factorisation into irreducibles.

*Some element $x$ has two distinct factorisations $p_1 \cdots p_n$, $q_1 \cdots q_m$ into irreducibles.

In either case, can we actually "construct" a nonprincipal ideal $I$ from the elements $x$, $p_1, \ldots, p_n$, $q_1, \ldots, q_m$?
Note this question is not an exact duplicate of this one, plus that question did not receive an answer anyway.
 A: The first case
At core, this argument can be summarized as:

If $x$ cannot be written as a product of irreducibles, we can get an infinite  descending chain of non-trivial divisors. Then the union of the corresponding ascending infinite chain of principal ideals cannot be principal.

If non-unit $x=x_0$ has no factorization into irreducibles, then $x$ is not irreducible, so there must be a factorization of $x =ab,$ with both $a,b$ not units.
Then at least one of $a,b$ must not be writable as a product of irreducibles. Let $x_1$ be that element.
Similarly, let $x_{n+1}$ be a non-trivial factor of $x_n$ such that $x_{n+1}$ cannot be written as a product of irreducibles.
Then you have principal ideal inclusions: $$x_0R\subsetneq x_1R\subsetneq x_2R\subsetneq \cdots $$
Take the union: $I=\bigcup x_nR.$ $I$ is an ideal. Then for any $y\in I,$ $y\in x_{n}R$ for some $n.$ So $yR\subseteq x_nR\subsetneq I.$
So $I$ is not principal.
In fact, you can show that $I$ can’t be generated by a finite set of generators, because any finite set from $I$ is a subset of some $x_nR.$
So, the first case implies that there are non-finitely-generated ideals in $R.$

The second case
The second case, you can assume the $p_i$ and $q_j$ are distinct, by cancelling equal irreducible factors.
Then:
$$p_1\mid q_1q_2\cdots q_k$$
Now, if $p_1R+q_iR$ is principal, then it must be all of $R,$ or $p_1,q_i$ cannot be irreducible. So we must have $x_i,y_i\in R$ so that $$p_1x_i+q_iy_i=1.$$
But then taking the product of these equalities, we get $X,Y\in R$ such that:
$$p_1X+(q_1q_2\cdots q_k)Y=1.$$
Recall that $p_1\mid q_1q_2\cdots q_k$: hence the above equation shows that $p_1\mid 1,$ so $p_1$ is not irreducible.
So at least one of the ideals $p_1R+q_iR$ is non-principal.
(Technically, you need a lot more arguments about “distinct up to a product of units,” or that $p_1R\neq q_iR$ for all $i.$)
A: Your statements are the negations of existence and uniqueness of factorizations into irreducibles. Since PID $\Rightarrow $ existence and uniqueness, by contrapositive, negating either $\Rightarrow \lnot \rm PID,\,$ hence some nonprincipal ideal exists. Indeed, one of the ideals assumed principal in these proofs must fail to be principal for the proof to break down - which yields your sought "construction".
For example, let's consider the case of uniqueness. If that fails then so too does Euclid's Lemma, and we can state that in a form that makes the nonprincipality explicit as below - which is the common Bezout-based proof of Euclid's Lemma recast into (principal) ideal form (recall that "contains" = "divides" for principal ideals, i.e. $\,(d)\supseteq (c)\!\iff\! d\mid c\,)$
Euclid's Lemma $ $ If $\,(a,b)\,$ is principal then if $\,a,b\,$ are coprime and $\,a\mid bc\,$ then $\,a\mid c$
Proof $\,\ (a,b)=(d)\Rightarrow d\mid a,b\,$ coprimes, so $\,d\,$ is a unit, so $\color{#c00}{(a,b)=(d)=(1)}\,$ therefore $\, (a)\supseteq (ac),(bc)\Rightarrow (a)\supseteq (ac,bc)=\color{#c00}{(a,b)}(c) = (c)\Rightarrow a\mid c.\,$
Therefore if Euclid's Lemma fails, i.e. $\,a,b\,$ are coprime $\,a\mid bc,\, a\nmid c\,$ then  $\,(a,b)\,$ is nonprincipal. The same method works  to deduce nonexistence of gcds if we replace ideals by gcds.
Similarly the common proof of existence of factorization into irreducibles uses  ACCP (ascending chain condition for principal ideals) to deduce that ascending unions are principal, so if existence fails then some such union must be a nonprincipal ideal. But we can't judge if that satisfies your notion of "constructive" since you don't define it.
Remark $ $ More generally a domain is a PID $\!\iff\! $ it satisfies ACCP and is Bezout, i.e. every two-generated ideal is principal $(a,b) = (c)\ $ [$\!\iff\!$ every finitely generated ideal is principal].
For some explicit examples, the ring of all algebraic integers is Bezout and is closed under sqrt, so given any nonunit $a$ (e.g. $a=2$) we can generate an infinite properly ascending chain by repeatedly taking sqrts $(a) \subsetneq (a^{1/2}) \subsetneq (a^{1/4}) \subsetneq  \ldots $ The union of this chain is a nonprincipal ideal (cf. standard argument in Thomas's answer). Otoh, any non-UFD (quadratic) number ring satsfies ACCP, but is not Bezout (number rings, being $1$ dimensional, are PID $\!\iff\!$ UFD)
