$\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.