Friendly fire
From TF2 Wiki
Friendly fire was an option available to servers during the Team Fortress 2 Beta. It allowed players to damage or even kill their teammates. This made setting up an ÜberCharge quicker and also benefitted Spies as it discouraged spy-checking.
Valve removed the feature upon release as it was to cause errors within the game's code as well as harbouring potential for griefing. The low focus on accurate shooting in the game also meant that friendly fire could become an impediment if several classes attempted to co-operate with one another.
However, in normal play there are still three examples whereby a player can injure himself. Soldiers can take damage from their own rockets, Demomen can be injured by their own Sticky bombs and Grenades, and Engineers can take damage from their own Sentries.
There are also several ways to get a friendly fire kill that are still left in the game. As a Medic, you can be healing a Spy who backstabs a team-mate and as an Engineer, your Sentry rockets can injure and even kill your teammates though it should be noted that Sentry bullets can not.
Some players report that some projectile weapons such as the Rocket launcher can occasionally injure teammates but there is no evidence to support such claims.
Full friendly fire is still available as a server option but is rarely used in standard TF2 play.
An important thing to note is that even with friendly fire enabled, it is impossible to damage friendly buildings.

