I am trying to add a partition in my garage and the ceiling joist does not line up with the wall studs. So my question is which one do I go by?
It shouldn't make any difference. If it isn't any extra work I'd position the studs directly below the ceiling joists. This will make everything just a little stiffer and more solid.
I'm not an expert, but, I would suggest you make sure your room is the size you want and line it up there. If parallel to the ceiling, the wall will not sway as much if you were to put a force against it, and mount it to the floor. Parallel to the wall stud, and you may have wall movement at the top unless you put blocks in to stop it. Non-load bearing is your choice.