Hansteens gate 2 was built on a property formerly known as Sophienberg or Arbins løkke. Development began in 1856 when a small parcel of land was sold at the far western corner of the property. The building on this plot was constructed on behalf of a foundation, established to provide housing for non-married women (Kong Oscars Minde). The building was constructed according to designs by architect Christian Grosch and was completed in 1861. It was demolished to make way for the American embassy, completed in 1959, to a design by architect Eero Saarinen (this building is visible in the far right corner of the building above). The rest of the property was inherited by Carl Thorvald Schiøtt, who sold of a number plots to developers. New apartment buildings were constructed in the 1870s and 1890s, after an economic slump in the intervening decade. The corner building, Haanstens gate 2, was included among the four buildings along Drammensveien (Henrik Ibsens gate) to be completed in the first building phase.
I don't know the name of the architect or the specific year of construction, and the steep roof seems to be a later addition. This may also be the case for the projecting bay window on the corner. The building was demolished and replaced with a new office building in 1967. I believe the architect was Jon Engh. Hansteens gate 4 and 6 was also demolished as part of this development.
For more information about historic Oslo, buy my book, Det Tapte Kristiania, here.