First thing to do is restart the computer. If you are unable to save, try exporting to IDML, and if that fails I would force quit the application, then restart the computer. Auto recovery will kick in if you are lucky when you restart ID, at which point you should save the file with a new name, then export to IDML, and open that, then save again with a new name to continue working. If auto recovery fails you're no worse off than you are now with an unsaved file that can't be saved.
What are you doing when the message pops up? Version of ID? OS?