Fourth wall

The fourth wall is a theatre term referring to the audience. This originates in the idea that there are three walls on a stage: one on the back, one to the left, and one to the right, as well as an imaginary fourth wall in front that contains the players within their play. To "break the fourth wall" means to show awareness of the audience or other things outside of it.

Examples
The character of Iris Wildthyme is often the culprit for many mischievous fourth wall breaks, such as winking directly at the reader, (PROSE: Iris Wildthyme and the Unholy Ghost) saying "you better be following this at home" when referring to the listener understanding the complicated mind swapping, (AUDIO: The Iris Wildthyme Appreciation Society) or even having a multitude of well spirited references about the narrative medium, of Doctor Who in particular. (PROSE: From Wildthyme With Love)

First Doctor era
At the end of the first episode of The Aztecs, Tlotoxl looks directly into the camera as he announces Barbara to be a "false goddess" and vows to destroy her.

In The Web Planet, the Doctor struggles to answer a question asked by Ian Chesterton (in reality, William Hartnell failed to remember his line). After the Doctor finishes his less than coherent reply, Ian gives a bewildered expression to the camera.

The fourth wall was famously broken in the seventh episode of The Daleks' Master Plan, in which the Doctor wishes the viewers a happy Christmas. This is the only case in the series proper in which a character explicitly displays knowledge of being on TV; all other cases of fourth wall breaking involve the characters seeming to talk to or perform for the camera, but nothing that cannot be explained by another character or a mirror being in the position the camera is occupying or a character talking to themselves, and nothing which displays knowledge of being a TV character.

Fourth Doctor era
In part one of The Face of Evil, on emerging from the TARDIS, the Doctor talks to the camera, saying that he doesn't think he is in Hyde Park, putting his landing down to a "nexial discontinuity" and reminding himself to "overhaul those tracers" before walking off into the jungle.

In part four of Image of the Fendahl, the Doctor says, "Time's running out!", directly to the camera.

In part three of Underworld, having managed to successfully expel all the fumigation gas from the tunnels, the Doctor says to the camera, "I wonder where it all went?"

In part two of The Invasion of Time, the Doctor breaks the fourth wall by looking at the camera and quipping, "Even the sonic screwdriver's not going to get me out of this one". At the end of the same serial, he grins mischievously to the camera.

In part two of The Pirate Planet, it appears K9 makes an error when reporting data to the Doctor. The Doctor clarifies the figure and K9 replies, "Affirmative, Master." The Doctor then breaks the fourth wall by looking directly into the camera and says, "That's what I thought."

Fifth Doctor era
In the last scene of part three of Enlightenment, Wrack looks at the camera while laughing about how she will destroy the Doctor.

In the final scene of The Caves of Androzani, the Sixth Doctor looks directly at the camera and says, "Change, my dear — and it seems not a moment too soon".

Sixth Doctor era
A running joke throughout most televised stories with Peri Brown during the Sixth Doctor's era would be for Peri to, at some point, note confusion in her location because of the similar looking passageways ("All these corridors look the same to me" being the most common, but this could change in different scenarios). This was a reference to the numerous complaints that the BBC production crew would build few sets for corridors and tunnels and could simply change small things about the sets and camera angels to attempt to give the illustration of a larger construct. The added gag was suggested by Nicola Bryant, and has since become a piece of fan lore — notably used in both TV: The Curse of Fatal Death and GAME: The Gunpowder Plot.

During the final chapter of The Trial of a Time Lord, The Ultimate Foe, the Valeyard breaks the fourth wall by looking directly into the camera and chuckling.

Seventh Doctor era
In Remembrance of the Daleks part two, as Ace walks out of the B&B, the television announces, "A new sci-fi series, called Do...", before cutting to the next scene. In the cliffhanger of part three, after the Dalek ship lands outside Coal Hill School, despite the Doctor's prediction, the Doctor turns to camera and says, "I think I might have miscalculated" to the viewer. Unlike other cliffhangers of the classic series, the line is not repeated in the reprise at the start of part three.

Tenth Doctor era
During Journey's End, when the Children of Time are flying The Doctor's TARDIS, Martha Jones briefly turns and smiles at the camera, though the next shot implies she was meant to be smiling at the Doctor.

In the proms special, Music of the Spheres, the Doctor breaks the fourth wall by addressing the audience at the Royal Albert Hall.

Eleventh Doctor era
In Night Terrors, Alex notes to the Doctor that his son is scared of shows on the television and that he considers turning it off, the Doctor snaps, "Don't do that!", in a reference to the controversy that Doctor Who had gained over the years for being frightening to children.

Just before her death in Asylum of the Daleks, Oswin Oswald says, "Run, you clever boy. And remember", and turns to the camera.

At the end of The Snowmen, the Doctor breaks the fourth wall by saying, "Watch me run", to the camera.

In The Night of the Doctor, the Eighth Doctor claims, "I'm a Doctor... but probably not the one you're expecting." In context, he is replying to Cass Fermazzi's conversation with a computer about doctors; however, the line also alludes to his unexpected appearance in the story.

In The Time of the Doctor, the Doctor makes eye contact with the camera as he says, "I will always remember when the Doctor was me".

Twelfth Doctor era
In Deep Breath, after the Half-Face Man has fallen from his "escape pod" and been skewered on a spike on the top of the Elizabeth Tower, the Doctor looks directly into the camera as the question is posed: "Did the robot self-destruct or did the Doctor kill him?"

The beginning of Before the Flood features a lengthy segment where the Twelfth Doctor talks directly to the audience and explains the "bootstrap paradox", telling the viewer to Google it. He uses an analogy of how a theoretical time traveller went back in time to meet his hero Ludwig van Beethoven, only to find out he didn't exist, so the time traveller copies down all of Beethoven's music based on his future knowledge, and then publishes them under Beethoven's name. However this means the time traveller was inspired by Beethoven, who was inspired by the time traveller. The Doctor then leaves the viewer with the question "who composed Beethoven's fifth?", before he takes out an electric guitar and plays the Fifth Symphony, which transitions to the Doctor Who theme.

In Heaven Sent, the Doctor breaks the fourth wall by saying he is nothing without an audience while looking directly at the screen. This fourth-wall break is among a few rare instances in the TV series that were specifically included at the script stage.

Spin-offs
At the end of the Series 1 finale of K9, The Eclipse of the Korven, K9 Mark 2 breaks the fourth wall by looking directly at the camera and saying, "Affirmative".

Prose
On page 229 of the 280 page book The Infinity Doctors, the Doctor tells Omega: "The best thing about books is that you can always tell when you're getting to the end. No matter how tricky the situation the hero's in, you hold the book to your hand and think, "Hang on, I'm two hundred and twenty-nine pages in, with only another fifty-one to go.""

- The Doctor

Audio
In Bang-Bang-a-Boom! part four, the theme music starts and then cuts out when Mel points out that the supposed resolution was "too easy."

The Torchwood audio drama Torchwood_cascade_CDRIP.tor explicitly and blatantly breaks the fourth wall throughout, right down to its title and premise.

Comics
In Silent Knight, the Eleventh Doctor addresses the reader directly and says, "Incidentally, a happy Christmas to all of you at home.", just as his first incarnation had done in The Daleks' Master Plan.

In the Titan Eleventh Doctor back-up comic Wholloween, after the Doctor sees that the TARDIS has been egged and TPed by angry trick-or-treeters, he remarks, "This is why I stick to Christmas Specials."