Often special keys like that (space bar, Shift, Option/Alt) can be disabled by third party software or extensions. The way to test:
Quit out of InDesign, Restart your computer. If possible, disable your startup applications. (On a Mac, you could do this by holding down the Shift key on startup). OPEN INDESIGN FIRST before any other application. Test to see whether the Space Bar is now working. If it is working, there is an application/extension (like Anti-virus software, etc.) interfering. Watch carefully as you open other applications to find the culprit.
It could also be a problem with the Space Bar on your keyboard.
Steve is probably right, but depending on what you mean by "all of a sudden", another possibility is that you are in a text frame in a panel or something similar, and you need to exit. Try pressing Escape or Return, or try in a new document.