Most CCD users have learned the hard way about keeping thier optical path clean. But sometimes dust and debris gets in despite our best efforts. Sometimes this can be lived with sometimes not.

How a speck of debis blocks the light to the CCD depends on distance from the focal plane. The general rule is that the closer to the CCD the obstructing object is the sharper it will be in focus. An object on the CCD itself will generally appear in perfect focus. If the object is on the cover glass it will be partially in focus, while an object on the CCD window or optics near the camera will cast a circular shadow. If the telescope uses a secondary mirror (SCT, newtonian, cassegrain, etc) a ring like shadow will be cast, thus the "dust doughnuts" that many CCD users are familiar with.

Because debris on the window or in the optics only blocks part of the light striking any particular pixel the effect can be calibrated out using a flat field correction. Dust directly on the CCD generally can not be corrected for as there is nearly no light getting to the pixel underneath.

Debris on the surface of an engineering CCD that has been handled without the benefit of a clean environment. The debris on the CCD shows up in sharp detail. Dust on the window is causing the dark spots visible across the image.
Debris on the cover glass of a SBIG ST10 generated by the shutter scraping against the window area during movement.