Kinetic equation for an inhomogeneous plasma in a magnetic field