On the existence of three-dimensional hydrostatic and magnetostatic equilibria of self-gravitating fluid bodies