Is it possible to query the launch services database for applications that will open an arbitrary file or UTI type?
You can use this command to examine the launch services database. The -dump option gives you the entire database, then you can pipe this into grep and search for whatever you like.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -n7 'your search string'
Andrew Mortensen’s duti is a CLI that will list UTI handlers:
-d <uti>
lists the default handler;-l <uti>
lists all registered handlers.
See the man page for duti.
EDIT: as Lri points out in this answer, duti does not seem to list all possible applications (possibly because it does not take account of UTI inheritance? That would be a matter for further inquiry). His recommended solution, AllApllications would obviously be a better answer.