Are you using a public example with the Online Compiler? If so - which is it? It’s possible that the example is so old that it pre-dates support for the nRF52-DK. You can try selecting “mbed” in the project (in the left-side Program Workspace) and then right-click to “Update” the version of Mbed in the project. That might fix the problem.
If you are building from the command line (with Mbed CLI), could you send us the steps to recreate the problem? Perhaps you don’t have a valid Mbed project. Mbed OS2 projects can be a little quirkly with the CLI, especially if you have an older version. You can check the version you are using with “mbed --version”.