It is allowed, even with someone in scanner ranger if you are not engaged in any type of RP activity with another user. However it is not recommended, you should always dock before logging out.
Sometimes it can't be helped, if i have to leave in a hurry i often F1 in space after killing engines to stay in place.
Don't F1 if there's someone nearby who might report you. Docking and F1-ing is safest imo. because then the other guy can't say he never had a chance to stop you (Ya know, CD spam, chasing etc)