OK so it happens to the best of us - that invasion fleet is a few parsecs away and you've got nothing to defend with that'll get there in time. What do you do?
Just let it happen. Oh well, stick happens. Hope that when they invade they screw up the planet enough to take some of it's usefulness away.
Abandon ship (then sink it)! Since it's likely an outpost under threat, it's more than possible you have troop transports to hand. Forget "women and children first", get your soldiers out of there to fight another day. Once they're gone, noke everything you can. You'll still lose the planet, but at least those invaders will have to waste time and money rebuilding from scratch. This takes some resources from their war effort, and when you get around to re-taking the planet, it won't have too much of a defence.
Go down fighting. Cripple your economy buying planetary defences and fighters. At least they'll pay for daring to invade your holiday home. If you get real lucky, you may even buy enough time to get your armada there, but that's never a realistic target.
Use it as a bargaining chip to buy time. If they're in a good mood, handing over the planet with no damage might cheer them up enough for a quick break in the war, while you prepare plans to beat them to a bloody pulp, or at least pee in their coffee.
I'm generally spiteful enough to destroy and abandon the planet, but will sometimes peacefully hand it over if I *REALLY* need a break. What does everyone else tend to do?