I'm going in the opposite direction and saying I don't think the size of the house or apartment matters.
I agree. The space available isn't the issue, as you say, it is the problem of being left alone. That said, there are some unique problems with an apartment as opposed to a house. An unhappy dog won't be popular with your neighbours if it is screaming half the day. Bad enough in a detached house with some property around it, intolerable with close apartment neighbours with shared walls. Add to that the likelihood that the dog may hear noises from bordering apartments or the hallway that will set it off. As I said, for company a cat would be a far better option.
@mister-science, some people use treadmills with their dogs, which can be a good option if the desire is just to give them physical exertion, but won't solve their needs to get out and see and smell and explore.