Why does a non-physical magnetic field break the law for the force on a magnetic dipole? References (e.g. this one) usually say that the force on a magnetic dipole in a magnetic field is
$$\vec{F} = \nabla\left(\vec{\mu} \cdot \vec{B}\right) $$
So consider a circular loop in the $xy$ plane with current going around it. Suppose the $B$ field is in the $z$ direction, but $\frac{\partial B}{\partial z} \neq 0$.
Then the formula for the force is non-zero, but the force by the Lorentz force law is zero.
I suppose the problem is that the $B$-field I described isn't physical, since is has non-zero divergence, but where does that break the derivation of the law for the force on a dipole?
 A: Answer rewritten due to misunderstanding the quesiton.
The fact that the field you propose has a non-zero divergence breaks the derivation of the dipole force law at equations 10 through 12. The force on a wire loop parallel to the $x-y$ plane only occurs due to the transverse magnetic fields, namely $B_x$ and $B_y$ as seen in Equation 10.
$$f_z = -|\mu|(\partial_yB_y + \partial_xB_x)$$
Then, by assuming that the field is divergence-less (Equation 11)
$$\partial_xB_y + \partial_xB_x + \partial_zB_z = 0$$
we can simplify the force equation as (Equation 12)
$$f_z = |\mu|(\partial_zB_z)$$
A magnetic field that has a gradient along the z-axis must have gradients along the perpendicular directions to remain divergence-less. These perpendicular fields provide the Lorentz force on the wire loop.
A: For the force acting on the current loop lying in the $xy$ plane to be non-zero, the magnetic field gradient should have a non-zero component in the $xy$ plane, so $\frac{\partial B}{\partial z} \neq 0$ condition is not sufficient.
Here is a relevant quote from your reference article, where the gradient of the magnetic field is assumed to be in $y$ direction: 

If the gradient of B in the y direction is nonzero, then the forces
  shown in figure 2 will not cancel.

