I know that $\mathbb Z$ is not a field so this doesn't rule out non-principal ideals. I don't know how to find them though besides with guessing, which could take forever. As for $\mathbb Q[x,y]$ I know $\mathbb Q$ is a field which would mean $\mathbb Q[x]$ is a principal ideal domain, but does this still apply for $\mathbb Q[x,y]$ ?
Here is a general result:
If $D$ is a domain, then $D[X]$ is a PID iff $D$ is a field.
One direction is a classic result. For the other direction, take $a\in D$, consider the ideal $(a,X)$, and prove that it is principal iff $a$ is a unit.
This immediately answers both questions: $(2,X)$ is not principal in $\mathbb Z[X]$ and $(X,Y)$ is not principal in $\mathbb Q[X,Y]=\mathbb Q[X][Y]$.