Because coffee contains caffeine.
Caffeine is a substance found in drinks such as coffee, tea or coca cola. Caffeine has many properties and one of them, perhaps the most well-known one, is that is makes people unable to fall a sleep.
That is why Deflex doesn't work when there is something avoiding her from falling a sleep (caffeine).
Hope it helped,
Happy homework/ study/ exam!