At times Minecraft will hiccup and drop a saved world from the list of those available. The file is still there with the other saved worlds, it is just been corrupted. The missing world, and all your effort there, is recoverable. The things you were wearing and carrying at the time the world got corrupted are not.
Access your "saves" folder
For Microsoft Windows: 'C:\Users\your username\appdata\roaming\.minecraft\saves' by going to run and entering '%appdata%'
For Mac OS X:Go to the "Go" menu in the Finder, click "Go to folder", and type '~/Library/Application Support/minecraft/saves'
For Linux:Many repositories install Minecraft in the $HOME directory, '~/.minecraft/saves', running Minecraft as root is not recomended
You should see a folder for each of your saved worlds. For this example, let's say your corrupted world is called LostWorld.
Make a copy of the LostWorld folder and all files and folders inside it.
This copy can have any name you want. For this example we call it LostWorldCopy.
Start Minecraft and create a new world, then save and close Minecraft.
For this example we call this world BlankWorld. It doesn't matter what the new world is like. We only need it to harvest some files from it.
The inventory (i.e. the things you were carrying) from this world will also be used. Since an inventory in a new world is empty, it will also be empty in the restored world. You can fake a restored inventory by making BlankWorld a Creative world and putting everything you need into your inventory before closing the game. Don't forget your armor and any enchants on your armor and tools.
Go back to the .minecraft\saves folder
There will be a new folder BlankWorld for the world you just created.
Copy the following files from the BlankWorld folder to the LostWorldCopy folder:
level.dat_mcr (not always present)
Take care not to copy any folders.
Copying can be done with the normal methods for your system: Copy (or Cut) and Paste, select and drag, or other methods.
You should see a world called BlankWorld, with LostWorldCopy as the name of the folder in which it is saved. This is now your restored world.
There will also be a BlankWorld with BlankWorld as the folder. Ignore this one.
Test to make sure this world loads correctly.
You will start in a random location and have to find your way back to your settlement.
You might start underground and suffocate. If this happens you will loose all your items again (the ones you put into your inventory in Creative mode in BlankWorld). If you want to keep your stuff, start the whole procedure from the top. After filling your inventory in BlankWorld, make sure to put a stack of Enderpearls in the first slot. When you suffocate, try to escape by looking up and using the Enderpearls. You can also try to put yourself at a higher altitude in BlankWorld. You may then die from fall damage, but your items will still be there after you respawn.
In the Minecraft world select screen, rename BlankWorld to LostWorld.
This will now be your restored world.
To clean up, delete the BlankWorld world (the one that is saved in the BlankWorld folder).
The restoration will not be perfect. In particular:
Any saved information about mods (e.g. Thaumcraft research) will be lost.
Unless you used the 'fake restore' trick mentioned above, your inventory will be empty. You can also restore it with an NBT editor by copying the content of the root node from the file players/yourname.dat to the node "Player" in the file level.dat. (Directions needed)
Ender chest contents may be lost.
For Minecraft PE
The instructions above will work on Minecraft PE as well, but the only file you need to copy over is level.dat. The other files don't exist. This was tested on MCPE 0.10.5, but it may work on other versions as well. (As of 0.11, the game will attempt to repair corrupt saves.)