Magnetic Vector Potential and Ampere's law If I can set the divergence of $A$ as whatever I want, won't it affect Ampere's law:
$$\nabla ^{2}A=-\mu_0J$$
I could set it to zero and that would mean $\nabla 0=0=J$
I have understood the proof given in Griffiths where we are able to find a scalar function using Poisson's equation which in turn proves that we can always make the vector potential divergenceless but I don't get how this is compatible with Ampere's Law
Edit: I apologise for the inconvenience caused by $\nabla^{2}$.  I got confused over the definition of the Laplacian
 A: Ampère's law in differential form (in the case of no time-varying fields) is simply: $$\mathbf{\nabla\times B} = \mu_0 \mathbf{j}.$$
Now, if we write it in terms of the vector potential $\mathbf{B} = \mathbf{\nabla \times A}$, we get
$$\mathbf{\nabla \times (\nabla \times A) = \mu_0 \mathbf{j}},$$
which we can further expand using the mathematical identity for the curl of the curl, so that
$$-\nabla^2 \mathbf{A} + \nabla (\nabla \cdot \mathbf{A}) = \mu_0 \mathbf{j}.$$
Now, you're right that Gauge Invariance says that you have some liberty with the potentials. In particular, you can choose to set $\nabla\cdot \mathbf{A} = 0$, in which case the above equation just becomes
$$\nabla^2 \mathbf{A} = -\mu_0 \mathbf{j},$$ which is "Ampere's Law" in the Coulomb Gauge. Though that's a very bad way of describing it. It's basically the equation that allows us to calculate the components of the vector potential $\mathbf{A}$. In other words, all the components of the vector potential satisfy "Poisson's Equation". However, you are right that in general in another gauge this would not be true.
I'm not quite sure what you mean by the second part of your question: $\nabla \cdot \mathbf{A} = 0 \nRightarrow \nabla^2 \mathbf{A} = 0!$ The Laplacian is the divergence of the gradient, not the other way around...

EDIT 1: If you'd like a simple example of the above, consider the very simple field $$\mathbf{A} = 3 x^2 y\,\, \mathbf{\hat{x}}  - 3 x y^2 \,\, \mathbf{\hat{y}}.$$
It's a simple exercise to show that
\begin{equation*}
\begin{aligned}
\nabla \cdot \mathbf{A} &= 0, \text{ but}\\
\nabla^2 \mathbf{A} &= \nabla^2 A_x \,\,\mathbf{\hat{x}}+ \nabla^2 A_y \,\,\mathbf{\hat{y}}= 6 y \,\, \mathbf{\hat{x}} - 6 x \,\, \mathbf{\hat{y}} \neq 0.
\end{aligned}
\end{equation*}

EDIT 2: I also disagree with @my2cts answer. The claim that this is true in the Lorenz Gauge does not seem right to me at all. In the Lorenz Gauge $\mathbf{A}$ and the scalar potential $\phi$ satisfy wave equations:
$$-\frac{1}{c^2}\frac{\partial^2 \mathbf{A}}{\partial t^2} + \nabla^2 \mathbf{A} = - \mu_0 \mathbf{j}\\ -\frac{1}{c^2}\frac{\partial^2 \phi}{\partial t^2} + \nabla^2 \phi = - \frac{\rho}{\epsilon_0}\\$$
Now, it's true that if $\mathbf{A}$ does not depend explicitly on time, then this wave equation just reduces to Poisson's Equation given above. It is also true that when we are dealing with static Electric and Magnetic Fields one usually uses time-independent potentials (say $\mathbf{A}$ and $\phi$).
However, there is no reason for us to only use time-independent potentials! Gauge invariance tells us that we should be able to write $$\mathbf{A'} = \mathbf{A} + \nabla\lambda(x,t), \\ \phi' = \phi - \frac{\partial \lambda}{\partial t}(x,t),$$ such that both $\mathbf{A'}$ and $\phi'$ will be time-dependent! (Of course, I have no doubt that it'd be a real pain to work with these potentials, but in principle, we could!)
But importantly, in this case, the wave equation does not reduce to Poisson's Equation for $\mathbf{A'}$.
A: The solution of $\nabla ^{2}A=-\mu_0J$ captures all the physics of a magnetostatic problem. If you are looking for changes of $\vec \nabla \cdot \vec A$ such that the equation remains valid, these should obey $$ \nabla^2 (\vec \nabla \cdot \vec A) = 0 ~.$$
This is obtained by applying the divergence operator to both hands. andI setting the $\vec \nabla \cdot \vec J = 0$ as is appropriate for magnetostatics.
The Poisson equation in the OP is not gauge invariant. If you want to apply a gauge transformation like in @Philip's answer, you need to replace it by the Maxwell equations $$\partial_\mu F^{\mu\nu} = j^\nu / \epsilon_0 ~,$$
where $$F^{\mu\nu}=\partial^\mu A^\nu - \partial^\nu A^\mu$$
My interpretation of your question contrasts with @Philip's interpretation, which is the generally accepted one, of the Poisson equation as only valid in the Coulomb gauge. Clearly it is always valid for magnetostatics. The full gauge invariant equation only gives more solutions, all of which are useless.
