I was in the foggy route in Pokemon platinum, and I was facing against a trainer with a Luxio that spammed double team. It never failed. I was wondering if it could.
It can fail, or be unusable in general if:
The stat is already maxed out. If that Luxio used Double Team seven times, on the seventh it would fail.
The move was Disabled through the move Disable or the Ability Cursed Body. If this occurs, the move can't be selected until the Disable effects wear off.
The Pokemon was subjected to Torment, then used Double Team. On the next turn, it would be unable to use Double Team again.
If a Pokemon is Taunted, it is unable to use any status moves.
If an opposing Pokemon has Imprison and Double Team, Luxio would also not be able to use Double Team.
Source: Experience
Hope I helped!