Hasse principle for rational times square
$\def\ZZ{\mathbb{Z}}\def\QQ{\mathbb{Q}}\def\KK{\mathbb{K}}\def\LL{\mathbb{L}}\def\Gal{\mathrm{Gal}}\def\FF{\mathbb{F}}$Here are some examples of $\mathbb{K}$ for which this Hasse principle holds, and for which it does not.
Hasse principle $\KK= \QQ(\sqrt{b})$ a quadratic extension of $\QQ$. Let $\LL$ be the normal closure of $\KK(\sqrt{a})$ over $\QQ$. We break into cases according to $\Gal(\LL/\QQ)$.
Case 1 $\Gal(\LL/\QQ)$ is either $\ZZ/4 \ZZ$ or $D_8$ (the dihedral group of order $8$).
In this case, there is a conjugacy class $\sigma$ in $\Gal(\LL/\QQ)$ of order $4$ whose image in $\Gal(\KK/\QQ)$ is the nontrivial class. By Cebatarov, there are infinitely many primes $p$ of $\QQ$ whose Frobenius class is this $\sigma$.
Let $p$ be such a prime, chosen relatively prime to $2$ and $a$. Then $p \mathcal{O}_K$ is prime, with residue field $\mathbb{F}_{p^2}$ and $a \equiv q k^2 \bmod p \mathcal{O}_K$ for some $q \in \mathbb{F}_p$ and some $k \in \mathbb{F}_{p^2}$. But every element of $\mathbb{F}_p$ is square in $\mathbb{F}_{p^2}$, so $a$ is square in $\mathcal{O}/p \mathcal{O}_K$. We deduce that $p$ splits in $K(\sqrt{a})$ and thus in $\LL$, contradicting our choice of Frobenius class.
Case 2 $\Gal(\LL/\QQ)$ is $(\ZZ/2 \ZZ)^2$.
Then $\LL \cong \QQ(\sqrt{b}, \sqrt{c})$ for some $c \in \QQ$, and we have $K(\sqrt{a}) = K(\sqrt{c})$. But then $a=c k^2$ for some $k \in \KK$, as desired. $\square$.
No Hasse principle If we only formulate the Hasse principle as "for all but finitely many primes", then we have a counterexample whenever $\KK/\QQ$ is Galois of odd degree. The reason is simple: For any $a$ whatever in $\KK$, the condition will be satisfied at any unramified prime of odd characteristic.
Proof: Let $\pi$ be such a prime of $\mathcal{O}_{\KK}$, with residue field $\mathbb{F}_{p^f}$. Note that $f$ divides $[\KK:\QQ]$, so it is odd.
Then $\KK_{\pi}^{\times}/\QQ_p^{\times} \cong \FF_{p^f}^{\times}/\FF_p$ (because the extension is unramified). The quotient has order $p^{f-1} + \cdots + p+1$ which is odd, since $f$ is odd. So every element of $\KK_{\pi}$ is of the form $q k^2$ for $q \in \QQ_p^{\times}$ and $k \in \KK_{\pi}$, and it is easy to use an approximation argument to make $q \in \QQ$.
It is easy to choose $a$ to also work at the archimedean places, the even places and the ramified places, and thus get a counterexample to the whole claim.
I do not know if this is helpful but the question is clearly related to the Shafarevich-Tate group of some algebraic torus. Namely, let's consider algebraic torus $T=Res_{K/\mathbb Q}\mathbb G_m/\mathbb G_m$, where $Res_{K/\mathbb Q}\mathbb G_m$ is the Weil restriction of $\mathbb G_m$ from $K$ to $\mathbb Q$. Then from Hilbert 90 $T(\mathbb Q)=K^\times/\mathbb Q^\times$. Consider the short exact sequence $0\rightarrow T[2] \rightarrow T \xrightarrow{\times 2} T \rightarrow 0$, and the corresponding exact sequence of cohomology groups gives an embedding of $$(K^\times/\mathbb Q^\times)/(K^\times/\mathbb Q^\times)^{\times 2}\simeq K^\times/(K^{\times 2}\cdot \mathbb Q^\times) \hookrightarrow H^1(\mathrm{Gal(\overline{\mathbb Q}/\mathbb Q)}, T[2](\overline{\mathbb Q})) $$ And for every $p$, the points $T(\mathbb Q_p)=(\prod_{\mathfrak p|p}K_{\mathfrak p}^\times)/\mathbb Q_p^\times$ and so $$ (\prod_{\mathfrak p|p}K_{\mathfrak p}^\times/K_{\mathfrak p}^{\times 2})/ \mathbb Q_p^\times\hookrightarrow H^1(\mathrm{Gal(\overline{\mathbb Q_p}/\mathbb Q_p)}, T[2](\overline{\mathbb Q_p})) $$ So if you want to prove that $\alpha \in K^\times/(K^{\times 2}\cdot \mathbb Q^\times)$ is zero if and only if it is zero in $(\prod_{\mathfrak p|p}K_{\mathfrak p}^\times/K_{\mathfrak p}^{\times 2})/ \mathbb Q_p^\times$ for each $p$ you need to prove that the image of $K^\times/(K^{\times 2}\cdot \mathbb Q^\times)$ in $$ \underline{Ш}^1(T[2])= \mathrm{Ker}(H^1(\mathrm{Gal}(\overline{\mathbb Q}/\mathbb Q,T[2](\overline{\mathbb Q}))\rightarrow \bigoplus _{p}H^1(\mathrm{Gal(\overline{\mathbb Q_p}/\mathbb Q_p)}, T[2](\overline{\mathbb Q_p}))) $$ is zero. In particular this is true if $\underline{Ш}^1(T[2])$ is 0.
$\def\QQ{\mathbb{Q}}\def\KK{\mathbb{K}}$I've been meaning for a while to come back and talk about the group theory of this situation. I'm going to use GH from MO's fixed formulation: For every place $u$ of $\QQ$, there should be a rational number $q_u$ such that $a/q_u$ is square in $\KK_v$ for all $v$ above $u$. Note that all of the examples of "No Hasse" principle in my other answer do not incorporate GH from MO's fix, and disappear once it is included.
I will assume that $\KK/\QQ$ is Galois, with Galois group $H$. Others are welcome to work out the non-Galois case. Assume that the local condition holds.
Observation: $\KK(\sqrt{a})$ is Galois over $\QQ$. Proof: It is equivalent to show, for any $\sigma \in H$, that $\sigma(a)/a$ is square in $\KK$. Let $u$ be a place of $\QQ$. Then there is a $q_u \in \QQ$, and elements $x_v \in \KK_v$ for each $v$ over $u$, such that $a = q_u x_v^2$ in $\KK_v$. Then $\sigma(a) = q_u \sigma(x_v)^2$ in $\KK_{\sigma(v)}$. So $\sigma(a)/a = \sigma(x_{\sigma^{-1}(v)})^2/x_v^2$ in $\KK_v$. So $\sigma(a)/a$ is locally a square everywhere and hence a square.
Let $G = \mathrm{Gal}(\KK(\sqrt{a})/\QQ)$. So we have a short exact sequence $$1 \to \mathbb{Z}/(2 \mathbb{Z}) \to G \to H \to 1 \ (\ast)$$ which, since $\mathrm{Aut}(\mathbb{Z}/(2 \mathbb{Z}))$ is trivial, must be a central extension.
We have $a = q x^2$, for $q \in \QQ$ and $x \in \KK$, if and only if $\KK(\sqrt{a}) = \KK(\sqrt{q})$. This happens if and only if the extension $(\ast)$ is split.
If $\# H$ is odd, then any central extension is split and we are done; the Hasse principle holds. This has been observed in other answers.
But the local hypothesis puts additional constraints on the sequence $(\ast)$. Suppose that $\tau \in H$ has even order, and let $\sigma$ be a lift of $\tau$ to $G$. Let $(w,v,u)$ be a tower of places in $(\KK(\sqrt{a}), \KK, \QQ)$ respectively, with Frobenius elements $\sigma$ and $\tau$ corresponding to $w$ and $v$, and assume that $w$ is unramified with odd characteristic. Then $\KK_v:\QQ_u$ is even degree, unramified with odd residue characteristic, which means that all units of $\QQ_u$ is square in $\KK_v$. So $a$ is square in $\KK_v$, and we deduce that $\KK_v(\sqrt{a}) = \KK_v$. So $\sigma$ and $\tau$ have the same order. In short, we have shown:
If $\tau \in H$ has even order, and $\sigma$ is a lift of $\tau$ to $G$, then $\sigma$ has the same order as $\tau$. $(\dagger)$
There are many groups $H$ for which one check that $(\dagger)$ implies $(\ast)$ is split -- for example, cyclic groups, or $(\mathbb{Z}/2 \mathbb{Z})^n$. So that is a number more cases in which the Hasse principle holds.
However, $(\dagger)$ does not always imply splitting of $(\ast)$. The smallest example I can find is that $G$ is the $32$-element group $\left( \begin{smallmatrix} 1 & \mathbb{Z}/4 & \mathbb{Z}/2 \\ 0 & 1 & \mathbb{Z}/4 \\ 0 & 0 & 1 \end{smallmatrix} \right)$ and $H$ is the quotient by $\left( \begin{smallmatrix} 1 & 0 & 1 \\ 0 & 1 & 0\\ 0 & 0 & 1 \end{smallmatrix} \right)$.
All nilpotent groups are realizable as Galois groups over $\mathbb{Q}$, so thiere is some tower $\KK(\sqrt{a})/\KK/\QQ$ which yields this group. And this $a$ will not be globally $q x^2$. Will it obey the local condition? At the unramified primes, yes. If $v$ is a place of $\KK$ which is not split over $\QQ$, then $v$ splits further in $\KK(\sqrt{a})$, so $a$ is square in $\KK_v$. If $v$ is a place of $\KK$ which is split over $\QQ$, then $\KK_v \cong \QQ_u$ and $\sigma(a)/a \in \QQ_u^2$ for every $\sigma$, so we can find some $q \in \QQ$ such that $\sigma(a) /q$ is in $\QQ_u^2$ for every $\sigma$.
I'm not sure about the ramified primes.
If someone understands enough about the constructive Galois problem to rig up an extension with this Galois group, it would be fun to see.