Should be ok - but - the important thing about traps for wasps/yellowjackets is the location of each trap. Those insects operate in exactly the same way as Honey Bees in that scouts are sent out to locate food, and it is only when those scouts report back, that the mob then descends upon that specific food source.
All that placing a trap close to a beehive will do - although it does seems instinctively the right place for such a trap - is to advertise the hive as a potential food source.
The most appropriate location is downwind of the apiary, so that scouts will encounter the trap as they follow the scent plume which leaves the hive(s).
This, of course, does mean re-locating the traps whenever the wind direction changes.
Some of my hives are in a plum orchard, and I used to have a wasps/yellowjacket problem with windfall fruit rotting on the ground. Now I collect as much of this as possible and dump it at least 30 feet downwind of any hive. Problem solved.

LJ