Entry from British & World English dictionary
A compartment in a railway carriage without a corridor.
early 19th century: originally denoting a box for a dog to lie in, later denoting a railway compartment for transporting dogs.
in the dogbox
& South African informal In disfavour: I was in the dogbox right enough