It's worth discussing why this exists and it's worth trying to correct some issues upon finding this info.
Obviously, there is a spell to add/remove invincibility to the entire monster group... this provides invincibility to all physical, magical, and other attacks
Additionally, it is possible to start a monster group with invincibility to magic, by initially setting their magic defense to 255.
However, initially setting 255 defense to regular monsters doesn't work.. it has to be applied via the defense setting command (think Barbariccia and Cagnazzo).