You must buy your devices through the enterprise store, and then it is automatically linked to DEP.
Any idea why Apple does not provide a service to test whether a device serial number is DEP-managed?
Because once you know the serial number of a DEP device you can enroll into the MDM. There is virtually no security. See https://duo.com/labs/research/mdm-me-maybe