When you register a custom taxonomy make sure to set show_in_rest
to true
. This way the taxonomy will show in the REST API which is what Gutenberg uses to get the data.
Then you can use the selector:
wp.data.select("core/editor").getCurrentPostAttribute("my_taxonomy");