I have a production server running Ubuntu 9.04 with LAMP stack. I need to update the server to Ubuntu 10.10 but I am afraid it will also upgrade the MySQL, Apache and PHP packages. Can I upgrade Ubuntu 9.04 Server without affecting MySQL and Apache2 packages?
No; the new repositories that the newer version of the OS uses contain new major versions of the packages for software. Upgrading packages to the versions found in the new repository is an essential part of the upgrade process; in fact, it is the upgrade process.
The primary reason for this is that the old major version of apache you're running is no longer getting patched; they can't backport security fixes to every version under the sun, which is why they end support for some releases on an aggressive time table (which, in turn, is probably why you're looking at upgrading in the first place).
Pinning the package could keep it at an old version, but it would defeat the purpose of upgrading the OS in the first place - getting updates.
Edit: Oh, and to actually pull off the upgrade, since the repositories for 9.04 have been turned off, you'll need to follow a seperate upgrade path than you might find in some documentation. See here.
In theory, perhaps you could, but it wouldn't be 10.10, and it wouldn't be 9.04. You'll also likely end up with a pile of unupgraded dependent packages. This compromises both the tested and stable nature of a synchronised release, makes it harder to manage and upgrade in the future, and will probably expose you to unpatched vulnerabilities because you're not keeping everything up-to-date.
What you should do is test your application in an upgraded test environment, and then once you've identified any incompatibilities (which, if you have a properly engineered application, will be simple to identify and fix) upgrade production and roll out the upgraded application.