What wins out here...
For instance a wizard forcecages a stone golem.
Forcecage
Evocation [Force]
Level: Sor/Wiz 7
Components: V, S, M (see text)
Casting Time: 1 action
Range: Close (25 ft. + 5 ft./2 levels)
Area: Barred cage (20-ft. cube) or
windowless cell (10-ft. cube)
Duration: 2 hours/level
Saving Throw: None
Spell Resistance: No
This powerful spell brings into being an immobile cubical prison with bars or solid walls of force (the character's choice).
Creatures within the area are caught and contained unless they are too big to fit inside or can pass through the slits in the barred cage. All spells and breath weapons can pass through the gaps in the bars. Teleportation and other forms of astral travel provide a means of escape, but the force walls or bars extend into the Ethereal Plane, blocking ethereal travel.
Like a wall of force spell, the forcecage resists dispel magic, but it is vulnerable to a disintegrate spell, and it can be destroyed by a sphere of annihilation or a rod of cancellation.
Barred Cage: The barred cage is a 20-foot cube with bands of force (similar to a wall of force spell) for bars. The bands are a half-inch wide, with half-inch gaps between the bars.
Windowless Cell: The cell is a 10-foot cube with no way in and no way out. Solid walls of force form its six sides.
Material Component: Worth 1,500 gp, consumed when the spell is prepared.
The stone golem has spell Immunity:
Magic Immunity (Ex): Golems completely resist most magical and supernatural effects, except where otherwise noted below.
...
Magic Immunity (Ex): A stone golem is immune to all spells, spell-like abilities, and supernatural effects, except as follows. A transmute rock to mud spell slows it (as the slow spell) for 2d6 rounds, with no saving throw, while transmute mud to rock heals all of its lost hit points. A stone to flesh spell does not actually change the golem’s structure but makes it vulnerable to any normal attack for the following round (this does not include spells, except those that cause damage).
Something has got give here.
For instance a wizard forcecages a stone golem.
Forcecage
Evocation [Force]
Level: Sor/Wiz 7
Components: V, S, M (see text)
Casting Time: 1 action
Range: Close (25 ft. + 5 ft./2 levels)
Area: Barred cage (20-ft. cube) or
windowless cell (10-ft. cube)
Duration: 2 hours/level
Saving Throw: None
Spell Resistance: No
This powerful spell brings into being an immobile cubical prison with bars or solid walls of force (the character's choice).
Creatures within the area are caught and contained unless they are too big to fit inside or can pass through the slits in the barred cage. All spells and breath weapons can pass through the gaps in the bars. Teleportation and other forms of astral travel provide a means of escape, but the force walls or bars extend into the Ethereal Plane, blocking ethereal travel.
Like a wall of force spell, the forcecage resists dispel magic, but it is vulnerable to a disintegrate spell, and it can be destroyed by a sphere of annihilation or a rod of cancellation.
Barred Cage: The barred cage is a 20-foot cube with bands of force (similar to a wall of force spell) for bars. The bands are a half-inch wide, with half-inch gaps between the bars.
Windowless Cell: The cell is a 10-foot cube with no way in and no way out. Solid walls of force form its six sides.
Material Component: Worth 1,500 gp, consumed when the spell is prepared.
The stone golem has spell Immunity:
Magic Immunity (Ex): Golems completely resist most magical and supernatural effects, except where otherwise noted below.
...
Magic Immunity (Ex): A stone golem is immune to all spells, spell-like abilities, and supernatural effects, except as follows. A transmute rock to mud spell slows it (as the slow spell) for 2d6 rounds, with no saving throw, while transmute mud to rock heals all of its lost hit points. A stone to flesh spell does not actually change the golem’s structure but makes it vulnerable to any normal attack for the following round (this does not include spells, except those that cause damage).
Something has got give here.