Certain dofs do not have dof-coordinates in the traditional sense.
Cases like this are elements with integral moments;

and therefore there is no way doing so by using locate_dofs_geometrical, that would compare the coordinate of the degree of freedom with whatever input requirements you have.

For such function spaces, each degree of freedom is associated with an entity (that being a cell, facet or edge), which one can use locate_entities on to find an entity whose vertices satisfies the requirement function. You can then use locate_dofs_topological to get the entities associated with that entity.