The interaction of planetary bodies with their surrounding magnetized plasma can often be described with the magnetohydrodynamic (MHD) equations, which are commonly solved by numerical models. For these models it is necessary to define physically correct boundary conditions for the plasma mass and energy density, the plasma velocity, and the magnetic field. Many planetary bodies have surfaces whose electrical conductivity is negligibly small and thus no electric current penetrates their surfaces. Magnetic boundary conditions, which consider that the associated radial electric current at the planetary surface is zero, are difficult to implement because they include the curl of the magnetic field. Here we derive new boundary conditions by a decomposition of the magnetic field in poloidal and toroidal parts. We find that the toroidal part of the magnetic field needs to vanish at the surface of the insulator. For the spherical harmonics coefficients of the poloidal part, we derive a Cauchy boundary condition, which also matches a possible intrinsic field by including its Gauss coefficients. Thus, we can additionally include planetary dynamo fields as well as time-variable induction fields within electrically conductive subsurface layers. We implement the nonconducting boundary condition in the MHD simulation code ZEUS-MP using spherical geometry and provide a numerical implementation in Fortran 90 as supporting information on the JGR website. We apply it to a model for Ganymede's plasma environment. Our model also includes a consistent set of boundary conditions for the other MHD variables density, velocity, and energy. With this model we can describe Galileo spacecraft observations in and around Ganymede's minimagnetosphere very well.