In defeating the Dominators on Dulkis, the Second Doctor sets off a volcanic eruption. He leaves the TARDIS, along with his companions, Jamie and Zoe, in the way, though, and it gets buried in lava, blowing a fluid link in the process. This forces the Doctor to use the emergency unit to take the TARDIS away from danger and indeed out of reality itself.
They land in a white void and as the Doctor fixes the TARDIS, Jamie and Zoe are lured outside and are confronted by white robots. The Doctor gets them back inside but, as they try to return to reality, the TARDIS explodes and the travellers are scattered into nothingness.
They end up in a forest where the trees become letters when seen from above. The Doctor, after facing a series of riddles, finds Jamie, but accidentally changes his face. They are soon reunited with Zoe and then encounter Gulliver, who gives them away to life-sized toy soldiers. They are taken to the edge of the forest, where a unicorn charges at them. They manage to turn it into a statue by loudly declaring that ‘it doesn’t exist.’
They continue on and reach a house, where the Doctor brings Jamie back to normal. They discover that the house is the entrance to a labyrinth. Here, while leaving Jamie behind, the Doctor and Zoe encounter the Minotaur and Medusa, whom they deal with in the same way as the unicorn.
Jamie, pursued by a soldier, climbs up a rock face with the help of Rapunzel’s hair and enters a citadel through a window, triggering off an alarm. He hides and finds Gulliver, who cannot see the White Robots who are chasing Jamie.
The Doctor and Zoe exit the labyrinth and encounter the Karkus, a cartoon character from Zoe’s home era. The Doctor accidentally manages to dispel the Karkus' "anti-molecular ray disintegrator" by commenting that no such weapon exists, and the Karkus attacks them. Unfortunately the Doctor can't get rid of the Karkus, because he has never heard of the character before and cannot say for certain that the Karkus is not real. Zoe, however, beats the Karkus into submission with her martial arts skills, and he allies himself with them. He takes them to the citadel, where they find Jamie. Zoe accidentally sets off the alarm again, but the trio do not hide and instead let the robots take them to the main control room.
Here, they meet the Master, a kidnapped Earth writer who underwent the same tests as them when he first arrived. He explains that he is getting old and needs the Doctor to replace him as creative source for the Land of Fiction.
While he is talking, Jamie and Zoe sneak into a library area where they encounter the White Robots again and become trapped in a giant book. The Doctor refuses the Master’s offer and climbs out through a skylight.
The Master hypnotises Jamie and Zoe, gets them to trap the Doctor and links him up to the Master Brain. The two battle, summoning up various fictional characters to fight against one another. The Doctor prevails, releasing Jamie and Zoe who override the Master Brain, causing the White Robots to destroy each other.
The Doctor unplugs the Master from the Brain and they all retreat to a side room. The White Robots destroy the Master Brain, the TARDIS comes back together and normality is restored.