With a question like this there are two ways to go: how would things play out in a work of fiction, and how would they play out in real life?
I think a lot of people have covered the "work of fiction" angle. If you were going to design a city from scratch and with none of the real-world financial or political constraints that cities face as they grow and evolve, you'd probably have a big network of underground shelters for people to hide in when the dragons came around.
But let's look at a similar real-life situation featuring unpredictable death from above: a city prone to catastrophic tornado damage. (I write this with my other browser tab open to a weather radar, because I'm currently under threat from a severe storm system right now).
Moore, Oklahoma extends a couple of miles on either side of Interstate 35 as it passes south out of Oklahoma City on its way to Dallas. It occupies about twenty square miles, which is fairly small by the standards of this part of the country, but with a population of around 50k it's one of the ten largest cities in the state.
And, unlike the larger cities of Norman and Oklahoma directly to its north and south, it's also had completely devastating tornado damage several times in the past few years. In fact, some of these tornadoes were destructive enough to merit their own Wikipedia pages. (I had a third link to post here, but I haven't got the reputation to post it yet.)
Now, what I want to highlight here is basically a direct analog of what's been suggested in many of the other answers. Among the casualties of the 2013 Moore tornado were several students at the Plaza Towers elementary school, one of two Moore elementary schools destroyed by the tornado.
In the days after the tornado, a proposed law requiring new schools in the state to be built with tornado shelters unsurprisingly gained a great deal of traction with the public. Now take a minute to think through what this says. It's not proposing public tornado shelters for everyone, or retrofitting existing structures, but merely that any new construction of schools will come equipped with some sort of tornado shelter.
In interviews with the media, the measure was immediately dismissed by the Governor as too expensive, and nothing came of it. What did happen? Well, the city of Moore updated its building code, essentially requiring that new construction be built to withstand EF-2 tornadoes.
Now, remember, the tornadoes that have repeatedly destroyed Moore are in the EF-4 and EF-5 range, not the EF-2 range. Since that probably doesn't mean anything to most people, here are the sample images from Wikipedia of EF-2 and EF-4 destruction:
EF-2 damage:
EF-4 damage:
(That used to be a house, if it's not immediately obvious.)
Okay, so how do we compare this to what we know about the (I'm assuming) medieval societies that we're imagining facing a dragon attack?
We know that many medieval cities were built around castles that served as a central fortress for the community. The laborers who worked in the city surrounding the castle would, in the event of an invasion, come inside of the castle.
Now I'm going to assume that the castle predates the dragon here, because nobody in his right mind would spend the time, money, resources, and man-hours it takes to put up a castle in an area where there were constant dragon attacks. To quote an article on HowStuffWorks by Craig Freudenrich (which I can't link to with a new account),
Castle building employed about 3,000 workers (like carpenters, masons,
diggers, quarrymen and blacksmiths) under the direction of a master
builder. ... Castles generally took two to 10 years to build.
Nobody would bother undertaking such a project if those three thousand workers kept getting eaten alive and/or set on fire. People would just live somewhere else. So I'm envisioning a castle built to keep out invading armies, not dragons.
Now, there's a problem with this. Castles, pretty much from the beginning to the end of their existence, have relied on the fact that having the higher ground is what you want in battle. Early "motte-and-bailey" castles were basically just walled buildings (often just made wood or even dirt!) put on top of a hill that would suck for an invading army to run up. And even later on, when castles started to get way more sophisticated, it was always the case that the most heavily-fortified part of the castle was also the highest off the ground.
11th-century motte-and-bailey castle
14th-century castle
On top of that, any castle seriously intended as a fortress would feature machicolations, which are great if you want to drop rocks on the invaders scaling the side of your tower but which are probably less useful when you're facing an indiscriminate airborn flamethrower.
So the parts of the castles which have been designed to be the most secure are in reality probably the least so. Moreover, these fortifications would have been constructed with the express purpose of preventing large underground structures from being built underneath them. This is due to the ancient combat tactic known as "mining," where an invading army would dig small tunnels under a building and use them to place explosives underneath the walls, hopefully breaching them. In fact, the moats that surrounding some castles were more to prevent mining than to keep out invaders on foot.
The one thing a castle would have underground would be its cellars, which were designed specifically to be a bit fire-resistant. (These were still a serious weakness a couple of reasons. Remember how Guy Fawkes was going to blow up the House of Lords by setting off an explosion in its cellar? And then there's the fact that, without modern construction techniques, every extra floor you add is just another thing trying to make the castle sink into the ground.) These underground storage rooms are where, in the event of a dragon attack, you'd have the best shot at surviving.
Remember, though, that these rooms aren't empty, like in the picture above; they contain all the provisions you're holding onto in case of a siege. And remember that, due to the difficult engineering problem of constructing a cellar which the castle doesn't collapse on top of, you're not going to be building these with a lot of extra room.
And here's the payoff for the bit about tornadoes above. Cities faced with tornadoes don't build extra infrastructure to protect their citizens. They use whatever they had already (so, church basements and YMCAs and so forth), the people at the top are taken care of one way or another, and the interchangeable people at the bottom of society are left to fend for themselves. (Oh, and if you think the nobles are going to give them time off work to dig themselves tunnels, you don't have a clear picture of what the serf/vassal system looked like.)
And tunnels aren't that great anyway. You know how to deal with an enemy who digs tunnels? Here's what Wikipedia has to say:
The oldest known sources about employing tunnels and trenches for guerrilla-like warfare are Roman. After the uprising in Germania the insurgent tribes soon started to change defence from only local strongholds into utilising the advantage of wider terrain. Hidden trenches to assemble for surprise attacks were dug, connected via tunnels for secure fallback. In action often barriers were used to prevent the enemy from pursuing....
The use of tunnels as a means of guerrilla-like warfare against the Roman Empire was also a common practice of the Jewish rebels in Judea during the Bar Kokhba revolt (132–136 AD). With time the Romans understood that efforts should be made to expose these tunnels. Once an entrance was discovered fire was lit, either smoking out the rebels or suffocating them to death.
Which makes tunnels without fortified entraces an unattractive defense against fire-breathing dragons.
So, how would cities under threat from dragons be designed? Well, unfortunately, they likely wouldn't be designed at all.