How do the symmetries of a system constrain gauge fields? As a simple example, take a constant magnetic field $\vec{B} = (0,0,B)$. This is invariant under rotations about the $z$ axis. However, we can express $\vec{B}$ as the curl of a vector potential $\vec{A}$:
$$\vec{A} = \begin{pmatrix}
0 \\Bx \\ 0
\end{pmatrix} + \nabla \lambda$$
for any scalar function $\lambda$. The vector potential is not invariant under rotations about the $z$ axis: if we rotate the gauge field by an angle $\theta$ about the $z$ axis the resultant $\vec{B}$ field is $(0, 0, B \cos \theta)$.
Though I've used a toy case, I'm interested in the case of a more general theory: is there any way to see the symmetry of the observables from the gauge field?
 A: The relation of magnetic field and the vector potential is independent of the coordinate system. My first attempt I got the same result, however, soon I realized that the coordinates also have to undergo the same rotation. So if one has the following vector potential
$$ \mathbf{A}(x,y,z) = \left( \begin{array}{c} 0, & Bx, & 0 \end{array}\right)^T $$
so rotating it by the well-known rotation matrix gives:
$$\mathbf{A'}(x,y,z)=\left(\begin{array}{c} Bx \sin\theta, & Bx \cos\theta, & 0 \end{array}\right)^T $$
For the curl computation, the curl has to be computed in the rotated coordinates. The rotated coordinates are:
$$ x' = \cos\theta x + \sin\theta y \quad \text{and} \quad y' = -\sin\theta x + \cos\theta y$$
Actually we need the inverse relation as we want to express the old coordinates by the new ones (fortunately we need it only for x):
$$ x = \cos\theta x' - \sin\theta y' $$
We now express the rotated vector potential by the new coordinates:
$$ A'(x',y',z') = ( \begin{array}{c} B(\sin\theta \cos\theta x' - \sin^2 \theta y'), & B(\cos^2\theta x' - \sin\theta\cos\theta  y'), & 0 \end{array} )^T$$
If we take now the curl of $\mathbf{A}$ we get the desired result:
$$ \mathbf{B'}=\nabla' \times A'(x',y',z') = \left( \begin{array}{c} 0, & 0, & B(\cos^2\theta + \sin^2\theta )\end{array} \right)^T$$
So the raised question has nothing to do with gauge invariance, it is all about rotational invariance.
A: Following Frederic Thomas's answer pointing out the error in my example of not accounting for rotation of the coordinates, I am now able to answer the question of the constraint on the gauge field:
Under the symmetry transformation $x \to x'$, $A(x) \to A'(x')$ may be expressed $A(x') + \nabla \lambda(x')$.
Using Frederic Thomas's expression for $A'(x')$ we can see that
$$A'(x') = B(\sin \theta \cos \theta \, x' - \sin^2 \theta y', \cos^2 \theta x' - \sin \theta \cos \theta \, y', 0)^T = B(0, x', 0)^T + \nabla \lambda(x')$$
where
$$\lambda(x') = \sin^2 \theta \, x' y' - \sin \theta \cos \theta (x'^2 + y'^2).$$
