When you can deny an ally's hero?
When he is under:
-DOOM (ultimate Doom)
-Venomous Gale (first skill Venomancer)
-Shadow Strike (first skill Queen of Pain)
Heroes, that can deny themselves
-Techies - Suicide Squad, Attack!
-Pudge - Rot
-Alchemist - Unstable Concoction
-Abaddon - Mist Coil
-Pugna - Life Drain when used on an ally
Example:
Also you can deny ally heroes with spells:
-Bane - Nightmare
-Kill with ally creeps that are being controlled by Chen, Enchantress or any hero with Helm of Dominator.
-Creeps created by Nature's Prophet, Lycan, Beastmaster and etc.