Long time listener, first time caller. Please be gentle; I will do my best to abide by the rules, but it will be a bit difficult for me to do. Allow me a small explanation:
My intro to LaTeX started with a template from my first physics instructor 5+ years ago. In the time since then, I've cranked out various beautiful and crisp lab reports/technical documents/resumes/etc with this wonderful language, but unfortunately, I've never really had time to learn the language well so much as I've just reused/tweaked/googled my way to success. So, in the end, although I've tried to be good with commenting new things for future reference, and have produced quite a few lines of code and many-an awesome looking document, I don't REALLY know what I'm doing as far as the more advanced front matter; I usually just cut/paste all front matter from one document to the next, since I'm not sure what odd piece might be the glue holding something important together. Hence, things may be a bit "Frankenstein-y" as far as being patched together in odd/potentially unnecessary ways.
I explain this because I'm unable to provide a truly "minimum" working example, since I don't really know which packages/commands/environments might be necessary/redundant/conflicting. I thus feel compelled to include my entire front matter + the minimum conflict areas, in the hopes that somebody can help me sort things out a bit.
I tried searching the forums before posting this, but can't seem to find a working solution specific to what I've got going on here. Much thanks in advance for any helpful input anyone might be able to provide.
PROBLEM DESCRIPTION: I am trying to \ref{}, within a \pmatrix environment that is itself with an \align{} environment, an Appendix with a \label{} at the end of my document. The Appendix is given using a \newcommand called \question and has a manual bookmark. I've tried putting the \label{} command in various places, before and after the bookmark, for example; I've tried putting the \ref{} command itself in different places within the pmatrix/align environment, including inside a \text{} command in case that was the issue; I've even tried playing with the ordering of the bookmark and hyperref packages in the front matter. But all to no avail. The strange thing is, when I hover over the \ref{} (in Texstudio), it correctly identifies the \label and what it is referring to, and hovering over the \label itself correctly identifies "1 reference(s) to this label". The label also shows up in the auto drop down label list when I type \ref. However, when I hover over the relevant \end{align} tag, the reference is displayed as ??, and then, when I actually output to a .pdf, nothing shows up at all. I've seen the ?? before in an output .pdf and dealt with it, sometimes by nothing more than recompiling a second time, but this conflicting behaviour (and nothing showing up in the .pdf at all) is new to me. (And I'm not sure if this is relevant, but also I switched over from TexMaker only a month or so ago. So everything Texstudio is new to me as well.)
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{hyperref}
\usepackage[numbered]{bookmark}
\newcommand\question[2]{\vspace{.25in}\hrule\textbf{#1: #2}\vspace{.5em}\hrule\vspace{.10in}}
\newcommand\headNote[2]{\vspace{.25in}\hrule\textbf{#1 #2}\vspace{.5em}\hrule\vspace{.10in}}
\begin{document}
\begin{align*}
e^{\begin{pmatrix}1 & \lambda\\0 &1\end{pmatrix}} &= \mathbb{1} + M + \frac{M^{2}}{2!} + \frac{M^{3}}{3!} + ... + \frac{M^{n}}{n!}\\
&...\\
&= \begin{pmatrix}\left[1 + \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + ...\right] &\left[0 + \frac{\lambda}{1!} + \frac{2\lambda}{2!} + \frac{3\lambda}{3!} + ...\right]^{\text{(\ref{B})}}\\0 & \left[1 + 1 + \frac{1}{2!} + \frac{1}{3!} + ...\right] \end{pmatrix}\\
&...
\end{align*}
\newpage
\question{\large{Appendix B - Esplains}}{}
\bookmark[page = 2, level = 0]{APPENDIX B}
\headNote{Note: Here we feel compelled to esplains a step in Problem 8... blah blah:}{}\label{B}
math stuff
\end{document}

\labelneeds a numbered thing to attach itself to (a chapter, section, equation, etc.), and you've provided none in this document. Taking the liberty of updating your MWE with a much smaller document that still shows the empty()reference. – Mike Renfro Oct 01 '16 at 01:02\appendix\section{Esplains}? Manually numbering things is exactly the kind of thing humans are useless at and computers are great at. (Not to mention you'll get a whole bunch of automatic stuff done byhyperrefthis way.) Also, don't use e.g.\largein the argument. Customise that stuff globally. In any case\largeis a switch - it doesn't take an argument. – cfr Oct 01 '16 at 01:32hyperref.bookmarkwill do it anyway. – cfr Oct 01 '16 at 01:34\sectionetc. does for you. Actually, I pretty much do that in a custom class I use, but you still want to separate format from content and you absolutely need to do it with counters, make sure you are writing the correct stuff to auxiliary files etc. Using\sectionwould be a whole bunch easier. Just customise it however. (Even using a counter for the questions would help.) – cfr Oct 01 '16 at 01:39\label{}picks up the last\refstepcounter, basically. If you don't have anything which\refstepcounters, there's nothing to reference. – cfr Oct 01 '16 at 01:40\appendix\sectionisa real thing, then you will save yourself a great deal of time and frustration if you read a basic introduction. You may think you do not have time, but you will spend far, far longer if you don't and still you probably won't get good results. (You've probably spend many times as much time cutting-pasting-googling as you would have if you'd read a basic introduction 5 years ago. But there's no need to make it 10 or 20 years.) – cfr Oct 01 '16 at 01:42\sectionetc. to structure a document is pretty muchabc. It is pretty much the point. Really, go read an introduction. I cover this in the first couple of hours of a workshop aimed at complete beginners who first have to learn how to find somewhere to write it.bookmarkmust be a complete PITA if you don't use any semantic mark-up at all. – cfr Oct 01 '16 at 01:56