`GNU sed` with extended regex support (-E) to aid in regex writing.
sed -Ei -e '
/./b
:a
$q;N
/\
$/ba
s/^\
+(&|\\(begin|end)\{align\})/\1/
' file
Idea is to start collecting empty lines and stop when a nonempty line is seen. Then the regex will check whether the chunk of empty lines is followed by any one of the following three lines:
* a line starting with an ampersand `&`
* a line starting with \begin{align}
* a line starting with \end{align}
Then we delete these specific empty lines.