It is known that Gauss's law for magnetism is ∇ ⋅ B = 0. If we write this in component form it becomes (∂Bx/∂x)i + (∂By/∂y)j + (∂Bz/∂z)k = 0, where i, j, k are unit vectors in a cartesian coordinate system and Bx, By, Bz are the components of the magnetic field on these axes. It would follow then that all the partial derivatives must be zero: (∂Bx/∂x) = 0, (∂By/∂y) = 0 and (∂Bz/∂z) = 0 for this equation [ (∂Bx/∂x)i + (∂By/∂y)j + (∂Bz/∂z)k = 0 ] to obtain. But we know that there are magnetic fields with spatial gradients as, for example, in Stern-Gerlach experiment, where the magnetic force on a dipole of magnetic moment F is m⋅(∂Bz/∂z). How to reconcile mathematically ∇ ⋅ B = 0 with the fact that ∂Bz/∂z can be non-zero? Thank you.