They are detectable only if the issuer has a dedicated BIN for virtual cards. If they issue in the same BIN as your regular card, there's no way to detect without issuer cooperation, which would defeat the point.
How? Based on issuer identification number?
I'm pretty sure it can be done via the IIN. Services like https://binlist.net/ provide a convenient solution to identify if it's a prepaid card.
As one example, Oracle Cloud's Free Tier sign-up prevents any type of virtual card.
Oracle could productize a Trial Filter.. powered by Oracle Lawyers™.