Have you recently spilled any liquid on the keyboard? I know from personal experience that a small amount of water, coffee, or tea can cause some keys to stop working. The worst case is when liquid with sugar in it spills then dries, creating a sticky key mess.
Whenever I experience an issue with one or more keys I like to enable the Keyboard Viewer feature to what keys my Mac sees being pressed. It's also an excellent tool for seeing where special characters and symbols are located. Here is an excerpt from the Apple Help menu and a screenshot from my iMac showing what you should see.
- Click the Input menu in the menu bar, then choose Show Keyboard Viewer.If the command isn’t shown, choose Apple menu > System Preferences, click Keyboard, click Keyboard, then select “Show keyboard and emoji viewers in menu bar.”Open the Keyboard pane for me
- Click the Input menu in the menu bar, then choose the input source for the language whose keyboard you want to view.
Once you select the keyboard viewer a graphical representation of your keyboard will appear on you display. When you press the keys on the keyboard confirm whether or not you see the corresponding key highlight on the Keyboard Viewer. If the spacebar, caps lock, and delete keys do not respond on the keyboard viewer then you will likely need to replace the keyboard. If it's an Apple keyboard and it's still under warranty then you can either visit a service provider or contact Apple directly to arrange for a replacement.