We analyze two types of summation-by-parts finite difference operators for approximating the second derivative with variable coefficient. The first type uses ghost points, while the second type does not use any ghost points. A previously unexplored relation between the two types of summation-by-parts operators is investigated. By combining them we develop a new fourth order accurate finite difference discretization with hanging nodes on the mesh refinement interface. We take the model problem as the two-dimensional acoustic wave equation in second order form in terms of acoustic pressure, and we prove energy stability for the proposed method. Compared to previous approaches using ghost points, the proposed method leads to a smaller system of linear equations that needs to be solved for the ghost point values. Another attractive feature of the proposed method is that the explicit time step does not need to be reduced relative to the corresponding periodic problem. Numerical experiments, both for smoothly varying and discontinuous material properties, demonstrate that the proposed method converges to fourth order accuracy. A detailed comparison of the accuracy and the time-step restriction with the simultaneous-approximation-term penalty method is also presented.