When finding a potential vector for the $\vec{B}$ field I understand that we have certain freedom because if $\nabla \times \vec{A}=\vec{B}$ then $\vec{A'} = \vec{A} + \nabla \psi$ also satisfies $\nabla \times \vec{A'}=\vec{B}$
What I don't understand is why that gives us the freedom to choose $\nabla \cdot \vec{A}=0$, when you can only choose any scalar function $\psi$.
I thought that maybe it has something to do with the Helmholtz theorem but I got nowhere.
Thank you, in advance