In the days prior to being lobotomized, Babydoll retreats to a fantasy world in which she is newly arrived in a brothel owned by Blue, whom she envisions as a mobster. She befriends four other dancers — Amber, Blondie, Rocket, and Rocket's older sister, Sweet Pea. Dr. Gorski is envisioned as the girls' dance instructor, informing Babydoll that her virginity would be sold to a client known as "The High Roller". Gorski encourages Babydoll to perform an erotic dance during which Babydoll fantasizes that she is in feudal Japan, meeting the Wise Man . After she expresses her desire to "escape," the Wise Man presents Babydoll with weapons. He tells her that she would need to collect five items for an escape: a map, fire, a knife, a key, and a fifth, unrevealed item that would require "a deep sacrifice". Before parting ways, he instructs her to "defend herself," and she is confronted by three demonic samurai, which she defeats. As her fantasy ends, she finds herself back in the brothel, her dance impressing Blue and other onlookers.
Inspired by her vision of the Wise Man, Babydoll convinces her friends to prepare an escape. She plots to use her dances as a distraction while the other girls obtain the necessary tools. During each of her dances, she imagines adventurous events that mirror the secretly ongoing efforts. These episodes include infiltrating a bunker protected by steam-powered World War I zombie German soldiers to gain the map (mirrored by Sweet Pea entering Blue's office and copying a map of the brothel-institution); storming an Orc-infested castle to cut two fire-producing crystals from the throat of a baby dragon (mirrored by Amber stealing a lighter from the breast-pocket of a client); and boarding a train and combating mechanized guards to disarm a bomb (mirrored by Sweet Pea stealing a kitchen knife from the belt of the brothel's cook). During the last of these fantasies, Rocket sacrifices herself to save Sweet Pea and is killed when the bomb detonates, which is paralleled in a fight between the cook and the other girls in the brothel, ending with the cook fatally stabbing Rocket.
Blue overhears Blondie relaying Babydoll's plan to Madam Gorski. After discovering the gruesome scene around the cook in the kitchen, he has the grieving Sweet Pea locked in a utility closet and confronts the remainder of the girls backstage, proceeding to "make examples" by shooting Amber and Blondie. He then attempts to rape Babydoll, but she stabs him with the kitchen knife and steals his master key. Babydoll frees Sweet Pea, and the two start a fire so that, as a result of the fire alarm, the institution's checkpoint doors unlock. The two manage to escape into the courtyard, where they find their way out to be blocked by a throng of gentlemen. Babydoll deduces that the fifth item needed for the escape is in fact herself. Despite Sweet Pea's protest, she insists on sacrificing herself by distracting the visitors, thus allowing her friend to slip away.
The scene cuts back to the asylum in which the surgeon (Hamm) has just performed Babydoll's lobotomy. The surgeon is perturbed by Babydoll's expression and starts to question Dr. Gorski as to why she authorized the procedure. It is also revealed that the happenings in her dream world also happened in the hospital (stabbing an orderly, starting a fire, and helping another girl escape). Gorski realizes that Blue has forged her signature, and summons the police, who apprehend Blue as he attempts to assault a catatonic Babydoll.
Sweet Pea is stopped by police at a bus station while in line to board a bus to Fort Wayne Indiana, but she is rescued by the bus driver, who misleads the police; he is revealed to be the Wise Man from Babydoll's fantasies.
The film ends with the screen going black and Sweet Pea saying that "you have all the weapons you need, now fight!"