In Diamond and Pearl, a Pokémon with No Guard can successfully hit a Pokémon that has used Protect or Detect, but only if it uses a move with less than 100% accuracy. The lower the initial accuracy of the move, the higher its chance of breaking through Protect or Detect. Thus, when used against Protect or Detect, moves like Swift and Aerial Ace will always be blocked. One-hit knockout moves are exempted from this behavior and will be protected against. This battle mechanic was a bug, and was fixed in Platinum so that most moves are blocked by Protect and Detect.
Outside of battle
Outside of battle, if a Pokémon with No Guard is in the first place in the party (even if fainted), the wild Pokémon encounter rate increases by 50%.