I've come up with a bit of a compromise.
Getting straight to the point, here's a video showing off the one idea I could think of.
In the video, it looks like I'm ubercharged, but it's invisible to the enemy (or myself when taunting). Ubercharge of course means you won't be damaged by enemy. I can still shoot the enemy and damage them and whatever, but whatever they do won't hurt me (with a VERY specific exception I didn't test). The downside to this is that engineers buildings won't be invulnerable (there might be a way around that, but for the sake of simplicity, I didn't check).
What I didn't show was the fact that this was done using a "trigger_add_tf_player_condition" trigger. That trigger is what gave me the invisible ubercharge. This is important to this topic because when I leave the trigger (so the spawnroom), the effect wears off meaning I can once again take damage. If I wish to re-enter, I'm free to do so, and will once again stop taking damage.
If anyone wants to take a look at the .vmf to see how it was achieved,
CLICK HERE.
Now about the "VERY specific exception" I was talking about, I didn't test if knockback still occurred. I'm not saying it will happen, I just don't know this effect value too well. Never needed to use it. I guess players in the servers can be the guinea pigs.
To conclude, I can't think of a simple way of blocking stuff entirely, but you can block the damage given by weapons on players.