Prove that $f=x^4-4x^2+16\in\mathbb{Q}$ is irreducible
The associated quadratic polynomial $t^2-4t+16$ has negative discriminant, so there's no real root. Then the polynomial can be factorized over the reals as a product of degree two polynomial. You get them by a process similar to completing the square: \begin{align} x^4-4x^2+16 &=x^4+8x^2+16-12x^2\\ &=(x^2+4)^2-(\sqrt{12}\,x)^2\\ &=(x^2-\sqrt{12}\,x+4)(x^2+\sqrt{12}\,x+4) \end{align} These two polynomials have negative discriminant (no need to verify it) and so they're irreducible in $\mathbb{R}[x]$. If the given polynomial were reducible over the rationals, the two factorizations in $\mathbb{Q}[x]$ and $\mathbb{R}[x]$ would coincide.
Therefore the given polynomial is irreducible over the rationals.
What's the general rule? Suppose you have $x^4+px^2+q$, with $p,q$ integers and $p^2-4q<0$ (so $q>0$). Write $q=r^2$, with $r>0$ (it need not be integer), and $$ x^4+px^2+q=x^4+2rx^2+r^2-(2r-p)x^2 $$ Note that $2r-p>0$: it's obvious if $p<0$; if $p\ge0$ it's the same as $4q>p^2$, which is true by hypothesis. Then $$ x^4+px^2+q=(x^2-\sqrt{2r-p}\,x+r)(x^2+\sqrt{2r-p}\,x+r) $$ is the decomposition of the polynomial in $\mathbb{R}[x]$. It is in $\mathbb{Q}[x]$ if and only if $\sqrt{q}$ and $\sqrt{2\sqrt{q}-p}$ are integers.
For example, $q=4$ and $p=0$ is a case. For $q=16$ we need $8-p$ to be a square, so $q=16$ and $p=4$ is another case.
The polynomial has no real roots, because it is equal to $(x^2-2)^2+12$. The remaining possibility is thus that it is a product of two quadratic factors. By Gauss' Lemma these need to have integer coefficients, so we are looking for a possibile factorization like $$ p(x)=x^4-4x^2+16=(x^2+ax+b)(x^2+cx+d) $$ with some integers $a,b,c,d$. Modulo $3$ we have the factorization $$p(x)=(x^2-2)^2+12\equiv(x^2+1)^2.$$ Therefore $a$ and $c$ must both be divisible by three, and $b\equiv d\equiv 1\pmod3$. Modulo $5$ we have $$ p(x)\equiv x^4+x^2+1=(x^2+1)^2-x^2=(x^2+x+1)(x^2-x+1). $$ This means that $b\equiv d\equiv1\pmod 5$ as well. The Chinese Remainder Theorem (or case-by-case check) then shows that $b\equiv d\equiv 1\pmod{15}$.
Because $bd=16$ the only remaining possibility is that they are $1$ and $16$ in some order. But this is impossible because modulo $2$ we have $$p(x)\equiv x^4,$$ so all of $a,b,c,d$ must be even.
The conclusion is that $p(x)$ is irreducible.
Below is an explicit proof. Note that $x^4-4x^2+16 = (x^2-2)^2 + 12$, which clearly has no real root. Hence, the only possible way to reduce $x^4-4x^2+16$ over $\mathbb{Q}$ is $(x^2+ax+b)(x^2+cx+d)$. However, the roots of $x^4-4x^2+16$ are $x = \pm \sqrt{2 \pm i\sqrt{12}}$, which are all complex numbers. Since complex roots occur in conjugate pairs, $\sqrt{2 \pm i\sqrt{12}}$ must be the roots of one of the factored quadratic. Hence, the factored quadratic must be $$x^2-(\sqrt{2+i\sqrt{12}}+\sqrt{2-i\sqrt{12}})x + \sqrt{2+ i\sqrt{12}}\sqrt{2- i\sqrt{12}} = x^2-2\sqrt3 x+4$$ The other factored quadratic must be $$x^2+(\sqrt{2+i\sqrt{12}}+\sqrt{2-i\sqrt{12}})x + \sqrt{2+ i\sqrt{12}}\sqrt{2- i\sqrt{12}} = x^2+2\sqrt3 x+4$$ Hence, $x^4-4x^2+16$ is irreducible over $\mathbb{Q}$.
You've seen that $f(x)$ has no roots, so you want to exclude factorizations of the form $$f(x) = (x^2 + ax + b)(x^2 + cx + d)$$ Since $f(x) = f(-x)$, the above implies $$f(x) = (x^2 - ax + b)(x^2 - cx + d)$$ Here $a,b,c$, and $d$ are integers by Gauss's Lemma.
So a given root $r$ of $x^2 - ax + b$ is a root of $x^2 + ax + b$ or $x^2 + cx + d$.
If $r$ is a root of $x^2 + ax + b$, it is the root of the difference $x^2 + ax + b - (x^2 - ax + b) = 2ax$, which implies $a = 0$ since zero is not a root of $f(x)$.
If $r$ is a root of $x^2 + cx + d$ it is similarly a root of the difference $(c + a)x + (d - b)$, and since $f(x)$ has no rational roots $c = -a$ and $d = b$.
So either $a = 0$ or $c = -a$ and $d = b$. Since the argument is entirely symmetric in the two factors, we also either have $c = 0$ or $c = -a$ and $d = b$. Hence we have two possibilities: Either $a = c = 0$ or $c = -a$ and $d = b$.
In the first case we have $$x^4 - 4x^2 + 16 = (x^2 + b)(x^2 + d)$$ But the roots of $y^2 - 4y + 16$ are irrational (they're not even real) so this can't happen.
In the second case we have $$x^4 - 4x^2 + 16 = (x^2 + ax + b)(x^2 - ax + b) = x^4 + (2b - a^2) x^2 + b^2$$ Hence $b = \pm 4$ and therefore either $8 - a^2 = -4$ or $-8 - a^2 = -4$, neither of which has rational solutions.
Hence $f(x)$ is irreducible.
Suppose that $f$ is reducible, observe that $f$ is monic, hence $f$ can be written as the product of two polynomials $g$ and $h$ of degree at least one and with integer coefficients.
Now observe that $f$ has no integer root, because with rational root theorem an integer root to $f$ must be a divisor of $f(0)=16$ and you can check it's cases.
So $f$ has no linear factor, hence $g$ and $h$ are two monic polynomials with degree two, with letting
$$f(x)=g(x)h(x)=(x^2+ax+b)(x^2+cx+d)=x^4-4x^2+16$$
We get
$$
a=-c,b+d+ac=-4,ad+bc=0,bd=16
$$
Now if $a\neq0$, then $b=d$,$b+d+ac=-4$, so $b^2=16$, $2b-a^2=\pm8-a^2=-4$, which contradicts.
Now if $a=-c=0$, then $bd=16$, and $b+d=-4$ which again contradicts.