Hiding under your desk doesn’t do squat to save from a nuclear explosion.
Your assumption is incorrect. The advice is good, and your skepticism is misplaced.
If the bomb dropped directly on top of you it wouldn't matter-- but of course a vast number of people will be some distance from the hypocenter, and some may avoid death or injury by relatively simple measures. One Japanese woman, Akiko Takakura, survived the bombing at 300 meters from ground zero; another man in a well reinforced building is reported to have survived at 170 meters from ground zero.
Evidence from the atomic bombings of Hiroshima and Nagasaki demonstrated that people who were even minimally screened from the explosion did better. Additionally you have the problem of buildings falling, bits of ceiling, light fixtures and so on. You do the same thing in an earthquake, try to get under something to shield you from falling debris.
Experience with both nuclear and non-nuclear explosions demonstrated the dangers of shards of flying glass-- the shock wave that would blow them in trailed the first flash by some time (flash, speed of light; shock wave, speed of sound). Its particularly a problem because the flash itself draws people inside buildings to look out the window-- and facing a window is precisely the place you don't want to be when a shockwave hits
See:
Meteor explodes over Russia's Ural Mountains; 1,100 injured as shock wave blasts out windows
More of course can always be said, but /u/restricteddata addresses much of the premise about duck and cover in this and this older answer