Next, apply this analysis to the next promotion you seek, or the next job. Demonstrating your fit is what counts, by giving examples of how you approached a similar problem so the interviewer can see your transferable skills. You may have made yourself so indispensable to the organization in your current role, without doing succession planning, that management won't promote you because they don't want to lose your expertise in the role you have. Ask your manager, your colleagues, and your subordinates if any if they would rank you the same way you rank yourself. Of course there is no guarantee that you will receive useful answers or support, and there is nothing to be gained by arguing that you were rejected unfairly unless you can prove the company acted illegally and are willing to wait years to have a day in court.
Managers get to choose their own teams.
If you do get a helpful answer, you will have learned that the opportunities you were offered to develop your skills may have been the ones your employer found desirable at one time, but not the right preparation for new challenges facing the organization. You may need to be more pro-active in learning what it takes to stay current in your field and initiating getting that training instead of waiting to be offered something. Or, that your educational background isn't enough or is too old or is the wrong degree to qualify you for specific desirable promotions, and that you have to undertake more education. If you don't get a useful answer, this may be a not so subtle message that you've gone as far as you are going to go in this organization, and it's time to look outside the organization. You will still have to demonstrate competency and currency, but different organizations and managers may see you differently than your present employer, or offer opportunities that better fit with your strengths.