Who would command the Enterprise D, if Captain Picard, Commander Riker, and Commander Data were off the ship?
Of the main cast, apart from the three ranking officers mentioned, we also know of several instances of such cases:
- In TNG 'Descent', Beverly Crusher takes command
- In 'The Arsenal of Freedom', Geordi La Forge takes command when all the ranking officers are off the ship
More importantly though, it depends when you are referring to. At various stages, several commanding officers were on the Enterprise-D. This list assumes that the Captain, First Officer and Second Officer (whoever they were at the time) were off the ship
- Lieutenant Commander Sarah MacDougal
- Lieutenant Commander Argyle
- Lieutenant Logan
- Lieutenant Commander Leland T. Lynch
- Lieutenant / Lieutenant Commander Geordi La Forge
Chief Medical Officers
- Commander Beverly Crusher
- Commander Katherine Pulaski
Additionally, once Troi passed her Command test and achieved the full rank of Commander, she too could command the Enterprise.
I would say Commander Beverly Crusher, as she is a fully certified bridge officer and has the rank of commander. She took command of the enterprise on numerous occasions (see her Memory Alpha article)
Star Trek ships operations largely mimic modern Navy protocols.
That being said; The chain would be determined by seniority of the surface line officers, that is, the officers who are eligible for command. This excludes the staff corps and restricted line officers, such as supply officers, medical officers, or engineering duty officers. On a destroyer, cruiser, or frigate, the only staff corps would be the Supply Officer and the Disbursing Officer. The Disbursing Officer is a junior officer in the Supply Department who deals with the ship's finances.
So if the Captain is incapacitated, the next in line would be the Executive Officer, followed by the department heads, in order of seniority, then the division officers, in order of seniority. Seniority is determined by year of commissioning. For officers within the same year group, seniority is determined by lineal number, which is a ranking of the line officers Navy-wide.
So if the Captain is incapacitated and there is an Admiral aboard who is staff corps, such as a Medical Officer, command would still go to the Executive Officer, who would be junior to the Admiral.