Not being hindered by any knowledge on astronomy whatsoever (well, not a lot ;-)), isn't this just a problem of converting the spherical coordinates (altitude, azimuth, distance) to Cartesian ones and then applying Pythagoras' theorem? In fact, I'm sure that if I haul out my textbook on differential geometry I could apply Pythagoras directly to the spherical coordinates, but since that involves some messy mathematics with Jacobians and what-not, I prefer to use the workaround I understand.
In other words, assuming a right-handed (x, y, z)-coordinate system, with f the angle {P_x}{O}{P_y} (= azimuth), g the angle {P}{O}{P_z} (= 90 degrees minus altitude), and r the distance to the Sun, with P the position of the star in space, and a subscript indicating its projection on either one of the three coordinate axes, my math lecture notes state that
P_x = r cos(f) sin(g)
P_y = r sin(f) cos(g)
P_z = r cos(g)
Of course these formulas do not take into account the lattitude of the observer, nor the tilt of Earth's axis, nor the angle of the ecliptic. But somehow, I feel that those will simply fall out of the equation if azimuth and altitude are given relative to the constant observer's location: of course the absolute distance between stars should not depend on the position of the observer on Earth. Continuing, therefore, the position of the second star R is given b y a similar set of equations, resulting in a distance D of
D^2 = (r cos(f) sin(g) - r' cos(f') sin(g'))^2 + (r sin(f) cos(g) - r' sin(f') cos(g'))^2 + (r cos(g) - r' cos(g'))^2
Of course the above is more or less an educated guess, so take it with a pinch of salt, and try to obtain verification from people who did astronomy rather than chemical engineering ;-).
Edit: corrected the angle for the altitude.