By default, if you do not explicitly add “allowed spaces” to a query, the query can be used in all spaces. Here is an example query with the associated “Spaces” field highlighted:

You can change this behavior globally in the PocketQuery Configuration in the Confluence Administration (Confluence Admin > PocketQuery > Configuration):

If you enable the “Require dedicated spaces for queries” checkbox, your queries will need to have explicit spaces set on them for the query to run in a space. In other words, if you are in a space whose space key is not set on a query, this query will not be displayed in the macro browser in that space. Neither will results of such a query be displayed in a space, should you have changed this setting after adding the query in the now “disallowed” space.