If $\sqrt 2 = a/b\,$ then $\, 2b^2 = a^2,\,$ but $\,2b^2$ has an odd number of $2$'s in its unique prime factorization whereas $\,a^2$ has an even number of $2$'s, a parity contradiction (be careful - a rigorous proof of this must invoke the existence and uniqueness of prime factorization in several places, e.g. by existence $\,a\, =\, 2^{\color{#c00}I}\, 3^J\!\cdots p^K\,$ so the power of $\,2\,$ in this (necessarily) unique prime factorization of $\,a\,$ is $\,\color{#c00}I.\,$ So $\,a^2\! = 2^{\color{#c00}{2I}}3^{2J}\!\cdots p^{2K},\,$ so this must be the unique prime factorization of $\,a^2,$ so $\,2\,$ occurs to even power $\,\color{#c00}{2I}\,$ in $a^2.\,$ Similarly $2$ occurs to even power in $b^2,$ so odd power in $2b^2,$ by existence and uniqueness).
Remark $ $ It's simpler to use $2$-uniqueness, i.e. it is easy to prove that every natural can be written uniquely in the form $\, 2^I n\,$ for odd $\,n,\,$ thus $\, A= 2^{\large J}\! a,\ B = 2^{\large K} b\,$ for $\,a,b\,$ odd. Thus we deduce that: $\, A^2\! = 2 B^2$ $\Longrightarrow$ $\,2^{\color{#c00}{\large 2J}}\! a^2 \,=\, 2^{\color{#0a0}{\large 1+2K}} b^2.\, $ But $\,a,b\,$ odd $\,\color{#f2f}\Rightarrow$ $\,a^2,b^2\,$ odd too, contra $2$-uniqueness (LHS power of $2$ is $\color{#c00}{{\rm even}\!=\! 2J}\,$ vs. $\color{#0a0}{1\!+\!2K\rm\!=\!odd}\,$ on RHS).
The above shows how the ubiquitous parity proof in Vasya's answer is intimately connected to unique factorization.
Similarly for $\color{#c00}n$'th roots: if $\,2^{1/n} = A/B\,$ then $A^n = 2B^n$ so $\,2^{nJ}a^n = 2^{1+nK}b^n$ so $\,nJ = 1+nK,\,$ so $\,n\mid 1$, i.e. the powers of $\,2\,$ are incongruent $\!{\bmod \color{#c00}n}$ (vs. $\!\bmod \color{#c00}2$ as above), contra $2$-uniquness.
Generalizing this proof from $\,p = 2\,$ to an arbitrary prime $\,p\,$ would require generalizing the $\,\rm odd^{\large 2}\! = odd\,$ step that we used above, $ $ i.e. we would need a proof of the following inference $\ p\nmid a,b\,\color{#f2f}\Rightarrow\, p\nmid a^{\large 2},b^{\large 2}.\ $ Just as for the case $\,p=2,\,$ for any $\rm\color{#c00}{fixed}$ prime $\,p\,$ we could prove it by a brute-force case analysis, i.e. $\!\bmod p\!:\ a^2\equiv (a\bmod p)^2$ and $\,a\bmod p\in \{\color{#90f}{0,1,2,\ldots p\!-\!1}\},\,$ so it suffices to show $\,0\,$ is the only of those $\,\color{#90f}{p\ \rm integers}$ that squares to $\,0\pmod{\! p}.\,$ But to prove this for $\rm\color{#c00}{every}$ prime $\,p\,$ requires much deeper results, e.g. Euclid's lemma $\ p\mid ab\,\Rightarrow\, p\mid a\,$ or $\,p\mid b\ $ (or closely related results).