Boxfish are best kept alone in an aquarium without other fish due to the fact that they if stressed can release a toxin that can kill other fish that comes in contact with the boxfish. Boxfish are very slow moving and easily stressed. There are also reports that they can release the toxin if they die and thereby poison the rest of the fish in the aquarium. I can not say whether dead boxfish always release toxin or if this only sometimes are the case. It is recommendable to make sure to remove dead fish immediately to minimize to toxin released.
It is however possible to keep boxfish with other fish in a community aquarium but you will than need to make sure to minimize the stress the boxfish are exposed to. It is in order to achieve this important to avoid keeping them with large or aggressive species. Do not forget that some small species such as some goby species can be very aggressive and therefore isn’t suitable tank mates for boxfish.
There are a number of different boxfish species available in the aquarium trade. They are very interesting fish to keep if you can give them the care they require which can explain their growing popularity. One of the most popular species is Long-horned cowfish, Lactoria cornutus
Boxfish are best kept in larger aquariums with a small to moderate fish population in it. They prefer an aquarium with low to medium water circulation. The aquarium should be decorated so that the Boxfish can feel safe. This means that caves and other hiding places are highly recommended. (aquaticcommunity.com)