Let $K$ be a field; I will say a polynomial $f \in K[X]$ *represents* an element $a \in K$ if there exists a $b \in K$ such that $f(b) = a$.

Denote by $\mathbb{Q}$, $\mathbb{R}$ and $\mathbb{Q}_p$ the fields of rational, real and $p$-adic numbers respectively. Does there exist a polynomial $f \in \mathbb{Q}[X]$ such that

- $f$ represents only squares over $\mathbb{R}$ (but not all squares need to be represented),
- $f$ represents only squares over $\mathbb{Q}_2$ (but not all squares need to be represented),
- for every prime number $p > 2$, $f$ does not represent only squares over $\mathbb{Q}_p$?

If so, what is the minimal degree such a polynomial must have?

What I have found so far:

- A polynomial satisfying $1$ and $3$, but not $2$: $$ 1 + X^2 $$
- A polynomial satisfying $1$ and $2$ and which I think might also satisfy $3$, but I do not know how to prove it: $$ (1 + X^2)(17 + X^2) $$ Here, $17$ may be replaced with any positive integer with residue $1$ modulo $16$.