Even though your boss broke the upsetting news to you dosen't mean that she thinks that you are not qualifed or the right person for the position. She was encouraging for you to apply for the promotion so she probably has great faith and belief in your abilities. It is perfectly normal to be disapointed, however you seem to be very passionate about your job and I am sure that this does not go unoticed by your co-workers and your subordinates. The next time that they are considering people for promotions you will probably be at the top of the list. Just stay positive and everything will work out