One answer to your problem would be use aptitude to remove ubuntu-desktop
Originally Posted by danielsbrewer
Of course this assumes its a pure gnome desktop and you never installed KDE or XFCE.
sudo aptitude remove ubuntu-desktop
Then after completing this uninstall xorg.
if you've run a mixed environment a less elegenat solution would be to follow the instructions on pychocats website for a pure kde environment (or gnome of xfce environment). The pages show you how to remove all the fluff and desktop aps if you used apt-get instead of aptitude to install additional desktops.
Then once again remove xorg.
The only catch to this is that if you have gone and installed additional programs you'll have to root them out manually. you can use dpkg to find them
Not the most elegant solution and it will take some work but thats the best I can come up with for your particular problem.
dpkg --get-selections >sometxtfile
I hope this has been helpful and perhaps someone else can chime in with a better method.