If $G$ is compact Hausdorff, then by the Peter–Weyl theorem there is a homomorphism $G \to K$, to a compact Lie group $K$, such that $S^1 \subset G$ has nontrivial image in $K$.  Then $\smash{\tilde H}^*(BK; \mathbb{Q}) \to \smash{\tilde H}^*(B{S^1}; \mathbb{Q})$ has nontrivial image, and factors through $\smash{\tilde H}^*(BG; \mathbb{Q})$.