Usually it is said that the Maxwell equation $\vec \nabla . \vec{B}=0$ is solved by introducing the vector potential according to $\vec B=\vec \nabla \times \vec A$.
In principle, we could write the more general decomposition $\vec B=\vec \nabla \times \vec A+\vec \nabla f$ and require $\nabla^2 f=0$, right?
Why is this never done? Is it a particular case of Gauge invariance?