Sometimes, but not in the example.
In Damage reduction it states:
Whenever damage reduction completely negates the damage from an attack, it also negates most special effects that accompany the attack, such as injury poison, a monk's stunning, and injury-based disease. Damage reduction does not negate touch attacks, energy damage dealt along with an attack, or energy drains. Nor does it affect poisons or diseases delivered by inhalation, ingestion, or contact.
(My emphasis)
A Greater Shadow's (The shadow?) attack is:
Melee incorporeal touch +11 (1d8 Strength)
This is a touch attack, so DR will not stop this, doubly so as there is no damage to stop/negate thus the entire attack is str loss, not damage.
Other situations
For other attacks it will depend on how the ability damage is delivered.
- If the attack is a non-touch attack and deals damage to the target and also drains ability damage through (say) poison or disease then if the DR stops all the damage the poison and therefore ability drain is stopped.
- If the attack is a non-damaging touch type attack (Such as the Shadow) then the ability damage isn't negated, the DR has no effect. Note this would also include spells such as Touch of Idiocy - DR is no protection against this.
See also This related question regarding Damage reduction.