In the manga

In the Pokémon Adventures manga

If a person or a Pokémon is asleep near Darkrai, it suffers from horrible nightmares that can be fatal if the sleeping person or Pokémon doesn't wake up in time. The Ability is active even if Darkrai is inside of a Poké Ball.