The spaces in a hive that bees cannot access make favoured places for ants cos they are dry and warm. Keeping the ants out is a never ending battle if you want to fight it, me, I just give up and live and let live. That's unless they are argentine ants in that case I exterminate.
Here's a tip though, sometimes I'll get a hive just so bad with ants I need to do something. In that case I use the gas burner that I keep in the truck and burn them, I leave the burned ants on the hive mat, and other ants never come back. Or not for a very long time at least.