Other than having everyone use sets that have a configurable , internal dialplan, where certain numbers could be blocked, there is no way to prevent one extension from calling another.
You could make it as difficult as possible...use 5 digit extension numbers, and make the number ranges, in each office very different, but, if they knew each others extension number, they could still call.