Preheat the oven to 190°C/375°F/ Gas Mark 5.
Roll out the pastry either into a square or round, about the thickness of a 10p piece. Add to a floured baking sheet and prick it all over with a fork, then bake for 20 minutes. Remove from the oven, then increase the heat to 200°C/400°F/ Gas Mark 6.
Meanwhile, make the topping. Heat the oil in a saucepan and add the onions. Stir well until thoroughly coated, then add 2 tablespoons of water, season and cover. Turn the heat to low and cook for 20 minutes, stirring occasionally. Add a splash of water if the onions begin to stick.
Add the rosemary and remove the lid to dry out the onions. Pour the mixture over the pastry, leaving a 4cm rim around the edge. Add the beetroot wedges and crumbled cheese, then season and drizzle with a little oil.
Place in the oven for 10-15 minutes or until the cheese turns golden, scattering the hazelnuts over the top 3 minutes before the end of cooking to light toast them. Serve immediately.