We've done this several times and have never had a problem with it. Every restaurant has take out containers, so it shouldnt be an issue at all. As long as its not icecream of course. You should pick a dessert that keeps well. stuff like "mousse" wont keep well in the heat.
You can ask for the dessert to go. Some restaurants will box it for you in the kitchen, others will bring the dessert and box to the table and you will have to do it yourself.