A 40-pound dog is indeed too large to travel in-cabin on most (if not all) airlines and will have to ride as cargo. Besides very small pets, only trained and certified service or support dogs with legitimate documentation can sometimes accompany their owners in-cabin.