There are two methods available to you. The first thing that you should do is find out if the stucco is waterproof or not. Put a very small amount of hot water on a cloth and gently rub the stucco surface. Do this in the corner of the ceiling so that it will not be noticeable. If the stucco does not soften, then you will know that it is water-resistant. At this point you can apply some trisodium phosphate (TSP) with a bristle brush (if you want to be more careful, use a paintbrush) to clean the ceiling. If the stucco does soften when you apply the hot water, then you will have to use stain block. This is a very sticky substance that will attach itself to anything-including pollution and nicotine-that has likely built up on the ceiling surface over the years. Over that applying paint will not be a problem.