The enemy gets reduced xp and loses the gold they could've gotten from the last hit:
"Denying is the act of preventing enemy Heroes from getting the last hit by getting the last hit yourself. In most cases this prevents your enemy from gaining the full bounty of gold and experience from the kill.
Denying Creeps
You can deny creeps by forcing an attack command on them when they are under 50% health.
A denied creep divides 36 exp to enemy heroes within 1300 range. A melee\ranged creep would normally give 62\41 exp in 1300 range respectively."
Link