Pergola on flat roof: Can it be done safely?
Yes, I’ve done this, but it was designed into the roof. That is to say, we tied into roof beams with round steel pipes. The pipes were bolted into the roof beams and extended up through the roof about 12” or so. We caped the pipes so they didn’t leak and then used “plumbing jacks” (like ones made for plumbing vents,) to keep the roof from leaking. We then bolted cross beams to the pipes for the gazebo floor and kept the floor off the roof about 6” or so for drainage and cleaning. We then installed posts and a roof. (The structural system used bolts not just nails.)

Also, the roof beams were designed to hold the gazebo up, but it was also designed to hold it down (I live in a high wind area.) That means the beams need to be secured to posts and the posts need to be secured to the foundation adequately. 

If you use your concrete block idea, be sure that the roof is designed to support that much additional weight. Remember, roofs are usually designed to just support snow loads not live loads with all your drunken friends celebrating your 30th birthday. 

Wind factor increases the higher you go up. The effect of putting your gazebo on a three story structure means you’ll have significantly higher effects (lateral loads and uplift) of wind than one sitting on the ground. 

BTW, if you’re creating a roof top gathering place, you’d better install a guardrail to keep your friends from wandering over to the edge and falling off. (Blood is difficult to get out of sidewalks.)